There is a random fail if the newsletter random string contains HTML brackets.

testSendNowCron
fail: [Other] Line 340 of modules/simplenews/src/Tests/SimplenewsSendTest.php:
Mail has correct subject
Value '[Default newsletter] wjBX]>&d&d'.

Comments

ModernMantra created an issue. See original summary.

ModernMantra’s picture

Status: Active » Needs review

On line 281 in SimplenewsSendTest i placed the value to be wjBX]>&d&d and i did not get any failures on local machine (test bot on another issue fails on that case). Also tried with sample from test bot fail"K?*>>&and no fails at all on local machine. Strange, or i have done something wrongly...

miro_dietiker’s picture

StatusFileSize
new509 bytes

Let's try if testbot also fails?

miro_dietiker’s picture

And if this doesn't fail, we should try to encode it, it might get decoded accidentally somewhere.

ModernMantra’s picture

StatusFileSize
new595 bytes

Tests are ran many times and no single failure. I am suspicious about quotation mark since in test both failures string that is 'something common' wjBX]>&d&d' "K?*>>&. Uploaded 'dummy' patch just to trigger test bot and see failures... cases...

Status: Needs review » Needs work

The last submitted patch, 5: trigger_test_bot.patch, failed testing.

miro_dietiker’s picture

Retriggering tests...
For reference, these are the previous failing runs:
https://www.drupal.org/pift-ci-job/509973
https://www.drupal.org/pift-ci-job/509871

miro_dietiker’s picture

Hm, the SQLite just failed 3 out of 4 times...
The others pass mostly passed, only mysql with 5.5 and 8.3 failed once.
Still strange, i was hoping to find fully consistent behavior...

berdir’s picture

Those are two different kinds of fails. The second one actually has a @todo related to https://www.drupal.org/node/2575791, so maybe the strip tags behavior is not consistent.

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new1.46 KB

2 years on, the details of which tests are failing are probably different, but the problem still exists. Here is a patch that should solve the two that failed in the most recent run https://www.drupal.org/pift-ci-job/1192925.

1) SimplenewsAdministrationTest: the user is displayed as a link, so fix the tests to match (presumably this one fails always, not just randomly).

2) SimplenewsSourceTest: the problem comes from different HTML encodings, in particular whether to encode quotes. The mail text has legitimately chosen not to (because it isn't strictly necessary); HTML::encode encodes them anyway (because that's a safe thing to do). So comparing encoded values is not a good idea because there are many different alternative correct encodings. The solution is to compare decoded values rather than encoded values.

berdir’s picture

+++ b/src/Tests/SimplenewsAdministrationTest.php
@@ -379,7 +379,7 @@ class SimplenewsAdministrationTest extends SimplenewsTestBase {
     $this->assertEqual(1, count($rows));
     $this->assertEqual(current($subscribers['all']), trim((string) $rows[0]->td[0]));
-    $this->assertEqual($user->label(), trim((string) $rows[0]->td[1]->span));
+    $this->assertEqual($user->label(), trim((string) $rows[0]->td[1]->a));

seen this before in other cases, I think this is a permission thing/change.

Status: Needs review » Needs work

The last submitted patch, 10: simplenews.test-fail.2820130-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

adamps’s picture

Status: Needs work » Needs review

I can't reproduce the failure reported in #12.

seen this before in other cases, I think this is a permission thing/change

No doubt you are right. The question is: in what way does it change?

  1. If at some time in the past it used to always be a span then it changed, and now it's always a link, then my patch is good.
  2. If it randomly changes between span and a, then I agree, we need a different fix.

I can see there is still uncertainty, but I feel that my patch takes us forward. It might solve 2 problems and, if not, it gives us more information. On the other hand, the existing code failing again and again each night is telling us nothing new.

Please would you commit my patch so we can see what happens? I can follow up with more patches based on what we learn. It might take a few iterations, but we'll get this solved in the end.

berdir’s picture

Status: Needs review » Fixed

Committed the change, I think this is fine.

Still some more issues but hopefully non-frequent randoms, we'll see.

  • Berdir committed 076ea8e on 8.x-1.x authored by AdamPS
    Issue #2820130 by ModernMantra, miro_dietiker, AdamPS, Berdir: Random...
berdir’s picture

Status: Fixed » Active

Re-opening, https://www.drupal.org/node/26416/qa shows varying results. some branches passed, others did not (PHP 7.3 is mostly core issues)

berdir’s picture

I think the a/span change is something that changes in 8.7, so it is failing on 8.6. Maybe we can make the condition flexible enough to work with both a and span. See #3025597: Fix failing tests how I did that for TMGMT.

berdir’s picture

For now I changed the patch/issue test configuration back to 8.7, I usually prefer to set it to pre-release.

adamps’s picture

StatusFileSize
new505 bytes

Many thanks @Berdir

#17 is a good fallback option, but I would prefer to pin the tests down. It seems like this should be a link, and maybe there's a bug if it's not. Here is an attempt to give extra permission just in case.

berdir’s picture

Yes, it might be related to your work in core around administer user permssions?

adamps’s picture

Darn, the 8.6 one still failed. I'll do some more investigation.

Yes, it might be related to your work in core around administer user permssions?

Yes, this one #2921114: Username formatter ignores entity access.

adamps’s picture

Status: Active » Needs review
StatusFileSize
new532 bytes

Tricky as patch #19 works locally on D8.6.

Randomly trying a different permission in case that works.

adamps’s picture

Hurrah! Hopefully that's the end of this tedious issue - please can this be committed?

adamps’s picture

Ooops hold on, that test was D8.7. Just queued D8.6.

adamps’s picture

Status: Needs review » Needs work

Bah:-(

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new816 bytes

OK back to suggestion in #17

Status: Needs review » Needs work

The last submitted patch, 26: simplenews.test-fail.2820130-26.patch, failed testing. View results

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new792 bytes

Status: Needs review » Needs work

The last submitted patch, 28: simplenews.test-fail.2820130-28.patch, failed testing. View results

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new821 bytes
adamps’s picture

Yay at last, thank goodness I was bored of that issue. This should get all the tests back working, please commit.

berdir’s picture

Assigned: ModernMantra » Unassigned
Status: Needs review » Fixed

Thanks, committed.

  • Berdir committed 1096006 on 8.x-1.x authored by AdamPS
    Issue #2820130 by AdamPS: Improve tests to pass on 8.6 and 8.7
    
adamps’s picture

Assigned: ModernMantra » Unassigned
Status: Needs review » Fixed

The status and assigned fields sometimes appear with the wrong values on my system, so let's try saving again.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.