The assertion "The allowed text format appears as an option when adding a new node." in filter.test line 500 appears to be failing randomly. Here are two instances:

http://qa.drupal.org/pifr/test/99989
http://qa.drupal.org/pifr/test/99644

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alex_b’s picture

Status: Active » Needs review
FileSize
2.62 KB
929 bytes

Looking through the tests, the only potential problem I find is the fact that we use random names for machine names.

- Could it be that some random names are rejected by the machine name form element? The tests would not catch this and fail later.
- If the machine name form element isn't the culprit, where else could a random machine name fail silently?
- Are there other sources of randomness I am overlooking?

Attached 2 patches:

- 949872-1_filter_avoid_random.patch switches to deterministic names at the particular instance where we have random fails.
- 949872-1_filter_avoid_random_all.patch switches to deterministic names in all of filter.test

sun’s picture

Since this pattern is used in many tests, but only a specific one fails, I suspect the problem to be located in that filter test only.

jhodgdon’s picture

Status: Needs review » Needs work

This is interesting.

I just ran this test locally and it failed with the same error as in those qa.d.o pages.

Some debugging info:
- On line 453, the test creates the filter formats. It adds both 'tkhmIfWS' and 'xH5IhkNK' successfully (in this test run, those are the random names), in that order.
- On line 456, it should have loaded both these by name. This is not checked by an assertion.
- On line 458, it should have assigned $this->allowed_format to the first, and $this->disallowed_format to the second. This is not checked by an assertion.
- On line 499, it goes to the node/add page, and then on line 500 (the failure line) it checks to see if the allowed format is there, and fails. However, when I look at the debug output for that page, that first name is there.

AHA!

Here's the problem. The text it is looking for is coming from:

  function formatSelectorHTML($format) {
    return '<option value="' . $format->format . '">' . $format->name . '</option>';
  }

But the HTML source I am seeing in the debug output is:

<option value="cvx2lfsf" selected="selected">tkhmIfWS</option>

i.e. the new format is the default, whereas the HTML it is looking for doesn't have selected="selected" in there.

So that's the problem, and that's why it is only happening sometimes -- I guess sometimes the new format is not the default selected option. I'm guessing here...

I don't think the idea in #1 is the problem at all.

jhodgdon’s picture

Status: Needs work » Needs review
FileSize
3.02 KB

Here's a patch that I think resolves the problem, by not assuming one way or the other that when it looks for a filter format on the page, it's either selected or not selected. I'm just running the test locally, but thought I'd might as well let the test bot at it as well...

jhodgdon’s picture

It passed my tests. I'm going to run the test locally a few more times for the random aspect...

effulgentsia’s picture

Subscribe. No time to review now, but +1 to getting this fixed. It's been very annoying this last week especially, with bot failing good patches with an annoyingly high frequency.

sun’s picture

Thanks, jhodgdon! Your awesome analysis allowed me to work out a proper fix for this random failure.

That helper function is the bug in the first place. The test has to use a xpath to retrieve the available formats.

We do not care for the "selected" property in this test, since this test is solely about text format access, nothing else.

Attached patch is ready to be committed.

webchick’s picture

Status: Needs review » Fixed

Ok, let's try this. It'd be great to get rid of these random test failures because they've been sucking time from core devs the past week or so.

I asked sun about that helper function, but he confirmed it's only used by this test.

Committed #7 to HEAD.

jhodgdon’s picture

Agreed, sun's is a better test. :)

Status: Fixed » Closed (fixed)

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