Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Needs review
FileSize
4.99 KB

Failures actually seem to be in functional code. Alternatively, in bogus test expectations.

In any case, attached patch should expose what's actually going on.

chx’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
5.19 KB
1014 bytes

Well if we want to see what's going on then not using variable method calls would be good while at it.

Dries’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to 8.x.

Moving to 7.x.

webchick’s picture

Status: Fixed » Patch (to be ported)
David_Rothstein’s picture

Version: 7.x-dev » 8.x-dev
Status: Patch (to be ported) » Active

Doesn't sound like that patch was intended to be the final word here, was it? Just a cleanup patch to improve the assertion messages and help see what was going on...

Also not sure these random test failures exist in Drupal 7 at all (although they could).

sun’s picture

Priority: Major » Normal

Righto. The committed patch only exposes what's going wrong when the random test failure happens again.

guy_schneerson’s picture

We just had this issue on our first core patch and was a confusing experience, not saying it is a major issue but should definitely be fixed ASAP
the issue http://drupal.org/node/1662956 failed testing first time, second time passed.

hosef’s picture

I believe this issue just came up on #1145080: SelectQuery::countQuery() incompatible with UNION queries. I took a screenshot of the fail messages from the test bot before retesting incase they would be helpful.

catch’s picture

Priority: Normal » Critical
Berdir’s picture

I tried to look into this, but I have no clue how to figure out what's going on here. Can't see anything wrong either in the tests nor in the code, nothing that could cause this. It looks like the comment is not indexed, despite he should. Something weird going on with roles maybe?

Note that the line numbers of the screenshot don't match anymore.

alexpott’s picture

Status: Active » Needs review
FileSize
792 bytes

Got it!

The offending line of code is in comment_node_update_index()... specifically the assumption here that rid is numeric and anonymous will be 0 and authenticated 1

    // Prevent indexing of comments if there are any roles that can search but
    // not view comments.
    $index_comments = TRUE;
    foreach ($perms['search content'] as $rid) {
      if (!isset($perms['access comments'][$rid]) && ($rid <= DRUPAL_AUTHENTICATED_RID || !isset($perms['access comments'][DRUPAL_AUTHENTICATED_RID]))) {
        $index_comments = FALSE;
        break;
      }
    }

Obviously with the new machine name roles and the fact this test creates a role with a random rid is responsible for this test's random behaviour!

chx’s picture

Status: Needs review » Reviewed & tested by the community

Very very awesome. So if it created a role name which started with aa or something then it failed, not many strings are below 'authenticated' so that's why it was so rare.

webchick’s picture

I'm happy to commit this to stop the madness (on my way down to the sprint shortly), but doesn't this also mean we need test coverage for comment_node_update_index()? There's no reason we should have been getting random test failures; the code there is simply wrong, no?

chx’s picture

This is the test for comment_node_update_index :D

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Oh, ok. :)

Committed and pushed to 8.x. Rock!

Status: Fixed » Closed (fixed)

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

sun’s picture

Issue tags: +Random test failure