aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-09-18 09:47:57 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-09-18 09:47:57 +0100
commitfd34ae20e8e825600838cce79781a8c8b592b35a (patch)
tree23baaaabb8c11544fb1b48acf2a6f5fe37440c85
parentdc7613329c275cd158fdde8faf1c0e301f5b7202 (diff)
Revert using memcached cache in testing.
This can fail if the tests are being run in parallel.
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/State.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/State.pm b/perllib/FixMyStreet/DB/ResultSet/State.pm
index ac13ec2a4..de56c738c 100644
--- a/perllib/FixMyStreet/DB/ResultSet/State.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/State.pm
@@ -24,7 +24,10 @@ sub states {
my $rs = shift;
my $states = Memcached::get('states');
- if ($states) {
+ # If tests are run in parallel, the cached state in Memcached could be
+ # corrupted by multiple tests changing it at the same time
+ # uncoverable branch true
+ if ($states && !FixMyStreet->test_mode) {
# Need to reattach schema
$states->[0]->result_source->schema( $rs->result_source->schema ) if $states->[0];
return $states;