Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
aggregator.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2009 at 17:08 UTC
Updated:
15 Mar 2009 at 07:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
alex_b commentedThis patch fixes the problem.
Comment #3
alex_b commentedfixed patch
Comment #4
webchickI don't suppose I could give you puppy dog eyes and ask you to supply a test with this that confirms this fixes the problem? HmmmmMMMmmmMmmM? ;)
Comment #5
alex_b commentedAggregator's tests are using the site's own feed (/rss.xml). For getting etag and a static last-modified headers on /rss.xml we need to go into cached mode (easy) - but for some reason, etags and modified headers on /rss.xml are changing when removing/updating feeds on the same site.
I am assuming that somewhere the page cache is being reset, I did some digging, but I couldn't found out where.
I added a test that updates/removes feed items two times in a row. While it does check whether feed items are updated and removed correctly in this operation, it does not check if etag and last-modified based checks work, because we don't have a suitable feed to test against.
Comment #6
alex_b commentedI addressed the problem outlined in #5 by adding an aggregator_test module that generates a test feed with etag, modified or etag and modified headers. (This test module will also come in hander later, when we write test implementations for the aggregator API).
For pulling in this feed I had to refactor parts of the aggregator test: createFeed() only generated feed based on /rss.xml and did not allow for feed urls to be passed in.
The tests attached reliably detect problems when etag or last-modified are not reset properly.
Beyond this patch: Nice side effect is that we now have a framework for adding local test feeds. At some point we should discuss how we would like to handle this. I think fixes for the parser should come in the future with test feeds. I don't think these test feeds should sit all in the modules directory though, but somewhere on drupal.org.
Comment #7
alex_b commentedMinor fix.
Comment #9
alex_b commentedTests failed because the PHP syntax checker interprets the XML file in the patch: #365889: php -l interprets XML files
Comment #10
alex_b commentedThis issue is waiting on #366193: Testbed: Deploy syntax checking fix.
Comment #11
alex_b commentedComment #13
alex_b commentedUploading patch again as #7 keeps failing on the testbed while OK on latest HEAD locally.
Comment #15
webchickThat time was the Fields in Core patch, which broke HEAD. Sigh...
However, #7 shows a failure with feed-related tests, so that's at least useful. What platform are you testing on?
Comment #16
alex_b commented#15: Mac OSX, apache2, PHP5.2.6, MySQL 5.0.45
Locally, I can't reproduce the single fail from #7 that also came up in #13 earlier...
Comment #18
alex_b commentedI tested again with configuration in #16 [edit: and] the following configuration:
Linux Fedora10 2.6.27.12-170.2.5.fc10.i686,
Apache2.2
PHP 5.2.8
mysql 5.1.30
No fails.
Comment #20
alex_b commentedThis patch (still) applies and tests fine on my local installation.
In order to find out why the test bed does find one error, webchick suggested running the test on the command line - like the test bed. But running from the command line results in a bunch of errors on each Aggregator test.
How can I get to the bottom of this issue? Looking at the patch, are there some suspect changes that have caused trouble elsewhere?
Any input much appreciated.
Comment #21
alex_b commentedComment #23
alex_b commented#20: I did not use the --url option when using run-tests.sh
Comment #24
alex_b commentedFixed the error in #13, this is what was going on:
This patch introduces a test feed as a seperate file, getRSS091Sample() exposed the URL to the file using url(). When clean urls are disabled, url() produces an invalid URL (http://host/drupal7?q=modules/aggregator/aggregator_test_rss091.xml instead of http://host/drupal7/modules/aggregator/aggregator_test_rss091.xml)
When clean urls are disabled and tests are run from the command line, this invalid URL causes an error when aggregator.test checks for its availability. However, it does not cause an error if run from the web interface. Interesting lesson learned.
SUMMARY
Problem description: see initial post.
Patch
* Adds aggregator_test.module that exposes a test feed with etag, modified or etag and modified headers.
* Moves test feed from aggregator.test to its own file aggregator_test_rss091.xml so that it is accessible from aggregator_test.module, too.
* Makes createFeed() accept an optional $feed_url (in order to pass in the aggregator_test_rss091.xml url).
* Adds tests for correct etag and last-modified caching to testRemoveFeedItem()
Comment #25
boombatower commented/me congratulates alex_b
Comment #26
chx commentedLet's make this clear: url() is NOT for file, it's for Drupal paths. url(NULL) is an ugly hack. Just use
$GLOBALS['base_url']Comment #27
alex_b commentedAddresses issue in #26, should have been part of #24.
Comment #28
alex_b commentedReplaces usage of url(NULL) for grabbing the rss.xml URL with $GLOBALS['base_url'].
Comment #29
chx commentedI am OK with the patch and so is the bot.
Comment #30
alex_b commentedI echo: This is ready to go in.
Once in, I can use aggregator_test.module to write an API + settings UI test for #293318: Convert Aggregator feeds into entities :)
Comment #31
webchickCool, I have no problem committing this once the following changes are made:
It's not URL, it's $feed_url
The PHPDoc of the functions you touch should be laid out like this example from file_load():
So basically, rather than:
It should be:
Are you sure this isn't possible now? http://drupal.org/node/299176#comment-1166241 was committed in December.
Comment #32
alex_b commented* Cleaned up comments on functions that this patch touches.
* Removed db_rewrite_sql().
Comment #33
alex_b commentedsetting to 'needs review'
Comment #34
alex_b commentedwebchick: input in #31 was very helpful, thanks for clarifications :-)
Addressed issues in #31, patch passes automated tests (#32): setting to RTBC again.
Comment #35
dries commentedThis looks good but we need to discuss the location of the test modules.
1. Sometimes the modules are in ./modules/simpletest/tests, sometimes not.
2. Sometimes the modules are in ./modules/FOO/tests, somethines in ./modules/FOO.
Comment #36
alex_b commented#35:
Good point. I am not happy with the sprawl of test files in aggregator/ (there are 4 now).
I think it's funny that in the case of locale module the tests/ subdirectory only contains the test module files, but not the .test file.
As a general rule, I would store all tests in a tests/ directory when there is more than a single .test file. Would that work?
Comment #37
webchick@Dries: The idea was that any module that defined tests would put them in modules/X/(tests/)module.test. To simulate what contrib will do. It used to force tests to be located in a "tests" subdirectory of the module, which was really nice for consistency, but for some reason that restriction was removed when SimpleTest module was added to core.
The test modules in modules/simpletest/tests/* are for testing files in the includes/* directory, which aren't scanned for modules/tests. An argument could be made that these should be moved to system module instead, for consistency.
But ./modules/simpletest/tests/taxonomy_test.module is definitely misplaced, that's true.
IMO we should go back to the old SimpleTest module way of always putting tests/test related files and modules in modules/X/tests/. Because:
a) I dislike that our module directories have turned into "file soup" after we did the page split and created .tpl.php files in Drupal 6. This just makes it dramatically worse.
b) Hiding this stuff in a "tests" sub-directory both means we can feel free to add all kinds of wacky random test-related files in there (as this patch does)
c) We can train our end users that they can just ignore anything in the 'tests' folder because it's 'scary' and for developers only. As opposed to "tum te tum.. looking or a template file I can copy to my theme.. what the?!? What is aggregator_test.module? Do I need to enable that?? Better post a support request on the forums!"
However, would it be okay to commit this patch as-is and handle moving around various test-related files in a separate patch, since this consistency issue affects a lot more than just the aggregator module's tests?
Comment #38
alex_b commentedDries: It would be great if we could commit this patch as-is, independently from the test file location question.
To that end I created a separate issue for test file locations: #383600: Move tests into subdirectory.
Comment #39
webchickOk, this has been hanging around a long time, so I went ahead and committed it. Let's discuss at #383600: Move tests into subdirectory on the best way forward wrt where files should go.
Thanks a lot! :)