The tests for the aggregator module use the site's own rss.xml feed as test data. When running the test on a vanilla install, there is no content and the tests run without problem. However, if you create content first, the three tests "Update/remove/categorize feed items" fail at the assertion Total items in feed equal to the total items in database (0 != 10).

The problem is that we are comparing the number of entries in simpletest766557node which is always empty when running the test, with simpletest766557aggregator_item which is populated with data from node instead of simpletest766557node.

Comments

webchick’s picture

Component: aggregator.module » tests
webchick’s picture

Title: Aggregator test relying on existing data. » Aggregator tests fail when existing content is present.
Priority: Normal » Critical
boombatower’s picture

It appears the test uses all drupalGet calls which use the database prefix and any queries the test executes should as well.

Not sure why the pre-existing content would affect it.

boombatower’s picture

Status: Active » Postponed (maintainer needs more info)

I tried this today and it didn't occur.

This may have been fixed, can someone else confirm.

webchick’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I also couldn't confirm this the other day (although I could originally on the dates when I changed the issue statuses). Perhaps something went in that fixed it.

I'm going to mark this closed for now. If it pops up again, I'll re-open it.

boombatower’s picture

yea :)

webchick’s picture

Status: Closed (fixed) » Active

Shoot.

Just marked #266521: aggregator test has failures as a dupe of this today, and I can reproduce it again now too.

I'm going to try and nail down some specific instructions for reproducing this.

webchick’s picture

Ok, it's actually really quite simple.

Do a fresh install of HEAD.
Run the test. Test passes successfully.
Create a node. Mine was an article, but I doubt it matters.
Run the test again. Test fails.

This would explain why some are getting inconsistent results, if we're trying it on totally clean installs in order to eliminate other potential problems.

webchick’s picture

Hm. I don't understand the point of this test?

I just enabled Aggregator module, added a couple feeds, updated the feed items, and looked at rss.xml. It only lists my node, not any aggregator feed items.

Is the test itself brain-dead, or is it me? :D

catch’s picture

As I understand it - it creates a node, pulls the test site's own rss.xml feed into aggregator as a feed (which should contain just the one node we created), then compares the feed items in the aggregator tables to the number of real nodes in the database - these should be the same because the site is aggregating itself. It's a bit weird, but it kinda makes sense, I think. But, shouldn't the node creation go in setUp() or something?

floretan’s picture

This line of the test:

$this->drupalGet('admin/content/aggregator/update/' . $feed->fid);

eventually leads to a call to aggregator_refresh(), which relies on drupal_http_request() to get the feed information. As it is now, drupal_http_request() does not transmit the database prefix, which is why we get content from the non-test website. #260778: Add SimpleTest user agent information to drupal_http_request should fix this.

After this issue with drupal_http_request() is solved, we should also create some nodes before running the tests. A feed with no items is no good for testing purposes (a random number of items would be better).

catch’s picture

Status: Active » Postponed

Marking as postponed since #260778 fixes this.

boombatower’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)

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