Detect cache out of sync with code on test list select

mattyoung - August 16, 2009 - 18:19
Project:SimpleTest
Version:7.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:boombatower
Status:closed
Description

If the user is able to select a test but is not found in the cache, this is certainly because the test case class name has changed.

Suggestion:

1. Print out a message instructing the user to clear the cache and try again or
2. Go ahead a clear the cache a come back to the list page, show a warning message "Code appears to be out of sync with cache. The cache has been cleared, select the test to run again."

#1

boombatower - August 16, 2009 - 18:31
Assigned to:Anonymous» boombatower
Status:active» needs review
AttachmentSize
550752-cache-sync.patch 1.02 KB

#2

System Message - August 17, 2009 - 07:20
Status:needs review» needs work

The last submitted patch failed testing.

#3

sun.core - August 17, 2009 - 07:34
Status:needs work» needs review

#4

boombatower - August 17, 2009 - 21:02

Passed first time...test slave fritsed second time

Result received from slave #29 (Passed: 12114 passes, 0 fails, 0 exceptions).

#5

boombatower - August 21, 2009 - 02:56
AttachmentSize
550752-cache-sync.patch 1.02 KB

#6

catch - August 21, 2009 - 03:06

Do we need to cache the test list at all? This is development only code, and not having new tests show up there is a pain.

#7

boombatower - August 21, 2009 - 16:48

I see the point, and the answer has to be no we don't have to. The reason it was added was due to the fact that it had to read the entire filesystem anytime it wanted to load the test list page. Since it piggy backs off the registry now it knows where the test files are, but it still has to load all the test files in order to generate the page.

That said, it gets slow reading all the files whenever you want to generate that page and is unnecessary and is not really scalable, especially when we think about contrib (now that mentioned it should clear cache when new modules installed).

Three options then:
1) Remove it
2) Have it compare its list against the registry always (should be less expensive then loading all files), and rebuilding if change
3) Leave the way it is

I am leaning towards #2.

#8

catch - August 21, 2009 - 18:53

I like #2.

Another option would be renaming the cleanup button / help text so it clears the simpletest cache too just for convenience.

#9

System Message - August 31, 2009 - 09:23
Status:needs review» needs work

The last submitted patch failed testing.

#10

lilou - August 31, 2009 - 12:38
Status:needs work» needs review

HEAD is broken.

#11

boombatower - November 6, 2009 - 21:16
Project:Drupal» SimpleTest
Version:7.x-dev» 7.x-2.x-dev
Component:simpletest.module» Code

#12

boombatower - November 6, 2009 - 22:15
Status:needs review» fixed

In simpletest_clean_environment() there already is:

<?php
 
// Detect test classes that have been added, renamed or deleted.
 
registry_rebuild();
 
cache_clear_all('simpletest', 'cache');
?>

Committed solution above as it makes a nice message popup when running tests that do not exist, instead of crashing. It also appends message to clean environment description.

AttachmentSize
550752-cache-sync.patch 1.59 KB

#13

mattyoung - November 7, 2009 - 15:49
Title:Detect cache our of sync with code on test list select» Detect cache out of sync with code on test list select

fix title typo

#14

System Message - November 21, 2009 - 15:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.