curlConnect() currently requests the front page at the beginning of each session, i.e. the first call to drupalGet() or drupalPost() in every test actually results in two requests.
AFAICT there is no need to do this. I assume this is a workaround for #293612: user_authenticate() should work when $_COOKIE is empty that has now been fixed (can anybody confirm this?). Only one test relies on this (Bootstrap > Page cache test), and that is easily fixed.
This patch removes the call to curlExec() from curlConnect(). curlConnect() is kept as a separate function but is renamed to curlInitialize(), because it no longer connects to the server.
I expect this to make the tests run faster, though I don't know whether it is noticeable.
Comment | File | Size | Author |
---|---|---|---|
#23 | curlConnect-3.patch | 5.66 KB | c960657 |
#19 | curlConnect-2.patch | 5.69 KB | c960657 |
curlConnect-1.patch | 4.17 KB | c960657 | |
Comments
Comment #2
c960657 CreditAttribution: c960657 commentedI have no idea why this doesn't pass in the testbed. All tests pass at my box. The Temporary query test doesn't even use the cURL framework.
Edit: Sorry, it actually does.
Comment #3
c960657 CreditAttribution: c960657 commentedComment #4
chx CreditAttribution: chx commentedAs the person who written this code I can certainly confirm that this was such a workaround. And the tests now pass.
Comment #5
c960657 CreditAttribution: c960657 commentedI just requested a re-test of the same patch, so it must have been a glitch in the testing robot.
Without the patch: Passed: 7294 passes, 0 fails, 0 exceptions
With the patch: Passed: 7149, 0 fails, 0 exceptions
This indicates that the number of HTTP requests is reduced by 145 (each extra call to curlExec() generates one assertion).
Comment #6
chx CreditAttribution: chx commentedComment #7
Dave ReidTested and works for me. Good improvement!
Comment #8
boombatower CreditAttribution: boombatower commentedNice work.
Comment #10
catchI can't reproduce the exceptions either.
Comment #11
boombatower CreditAttribution: boombatower commentedComment #12
webchickHm. Unfortunately, I can't commit this if it causes the testing bot to find failures/exceptions or we'll run into the same situation as over the weekend where ALL patches are marked CNW.
Let's wait to hear back from the testing bot. If it comes back green, feel free to mark back to RTBC.
Comment #14
c960657 CreditAttribution: c960657 commentedHmm, it appears that there is some problem with the patch or with the temporary query test. It is hard to debug without access to the error messages from the testbed. The attached patch tries to send some debug output back to me (don't know whether this is somehow blocked - we'll see). Do not review this patch.
The testbed did not reproduce the error in all runs, so it may be e.g. a timing issue or a race condition when several concurrent tests are run (I don't know exactly how the testbed works). I have tried running this test 20-30 times without seeing the problem. I have tried with and without $db_prefix, with and without $base_path, with PHP running as CGI and Apache 2 module, without any difference.
queryTemporary() uses a Engine=MEMORY table - I wonder whether that is subject to any memory constraints?
The temporary table is limited to the current database connection. Is there any chance that Drupal will reconnect to the database and thus use another connection between the two db calls in database_test_db_query_temporary().
[edit: patch removed]
Comment #16
c960657 CreditAttribution: c960657 commentedThis is the error that happens in the testbed:
Array
(
)
SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'drupal'@'localhost' to database 'drupal6_checkout'
/var/www/html/drupal6/sites/default/files/checkout/modules/simpletest/tests/database_test.module
line 58
Is the MySQL user missing the
Create_tmp_table_priv
on the testbed machine?Comment #17
catchSounds very likely. Opened #337761: Slaves need MySQL create temporary tables permission.
Comment #19
c960657 CreditAttribution: c960657 commentedReroll of original patch (without debug output) for HEAD. It includes an update to the test that was just added #323474: hook_boot() not invoked on uncached page views if cache mode is AGGRESSIVE.
Comment #20
Dave ReidThe new test in bootstrap.test for hook_boot and hook_exit would need to be changed with this patch, since it accounts for two requests in the first call to drupalGet:
Comment #21
Dave ReidCross-posted... :)
Comment #23
c960657 CreditAttribution: c960657 commentedReroll (there was a follow-up commit in #323474).
Comment #24
c960657 CreditAttribution: c960657 commentedComment #25
boombatower CreditAttribution: boombatower commentedPlease do not commit until #337761: Slaves need MySQL create temporary tables permission. is marked as fixed.
Secondly is this in D7 INSTALL.txt?
Comment #26
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Nice find, c960657.
Comment #27
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Nice find, c960657.