From 510493969100bec67d66292aaf073ed47fdd54f6 Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sun, 23 Dec 2018 14:41:40 +0900 Subject: [PATCH] Add test case which reproduces the issue #29 --- tests/Ackintosh/Ganesha/StorageTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/Ackintosh/Ganesha/StorageTest.php b/tests/Ackintosh/Ganesha/StorageTest.php index 7472722..eec18f4 100644 --- a/tests/Ackintosh/Ganesha/StorageTest.php +++ b/tests/Ackintosh/Ganesha/StorageTest.php @@ -3,6 +3,7 @@ use Ackintosh\Ganesha; use Ackintosh\Ganesha\Storage\Adapter\Memcached; +use Ackintosh\Ganesha\Storage\Adapter\Redis; class StorageTest extends \PHPUnit_Framework_TestCase { @@ -23,4 +24,22 @@ public function savesStatus() $storage->setStatus($service, Ganesha::STATUS_TRIPPED); $this->assertSame($storage->getStatus($service), Ganesha::STATUS_TRIPPED); } + + /** + * @test + */ + public function getLastFailureTimeWithRollingTimeWindow() + { + $r = new \Redis(); + $r->connect( + getenv('GANESHA_EXAMPLE_REDIS') ? getenv('GANESHA_EXAMPLE_REDIS') : 'localhost' + ); + $r->flushAll(); + $storage = new Storage(new Redis(($r)), null); + + $service = 'test'; + $storage->incrementFailureCount($service); + + $this->assertNotNull($storage->getLastFailureTime($service)); + } }