Skip to content

Commit

Permalink
Fix MemcachedEngineTest::testConfigurationConflict() rarely fails
Browse files Browse the repository at this point in the history
  • Loading branch information
tenkoma committed Dec 26, 2016
1 parent 0a3df0a commit 66c2401
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/TestCase/Cache/Engine/MemcachedEngineTest.php
Expand Up @@ -771,12 +771,12 @@ public function testConfigurationConflict()
{
Cache::config('long_memcached', [
'engine' => 'Memcached',
'duration' => '+2 seconds',
'duration' => '+3 seconds',
'servers' => ['127.0.0.1:11211'],
]);
Cache::config('short_memcached', [
'engine' => 'Memcached',
'duration' => '+1 seconds',
'duration' => '+2 seconds',
'servers' => ['127.0.0.1:11211'],
]);

Expand All @@ -786,10 +786,10 @@ public function testConfigurationConflict()
$this->assertEquals('yay', Cache::read('duration_test', 'long_memcached'), 'Value was not read %s');
$this->assertEquals('boo', Cache::read('short_duration_test', 'short_memcached'), 'Value was not read %s');

sleep(1);
usleep(500000);
$this->assertEquals('yay', Cache::read('duration_test', 'long_memcached'), 'Value was not read %s');

sleep(2);
usleep(3000000);
$this->assertFalse(Cache::read('short_duration_test', 'short_memcached'), 'Cache was not invalidated %s');
$this->assertFalse(Cache::read('duration_test', 'long_memcached'), 'Value did not expire %s');

Expand Down

0 comments on commit 66c2401

Please sign in to comment.