summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlistair Coles <alistair.coles@hp.com>2015-03-19 11:02:09 +0000
committerAlistair Coles <alistair.coles@hp.com>2015-03-19 11:08:06 +0000
commita624a593df7e92b06f5844e53a87a65c662aba4c (patch)
treea06e3d34baa1f7b3e4ba90ba8d225763dc5eb1f7
parentb7fabcc84aad9e3eb8597e9333fc073acf736ad3 (diff)
downloadswift-a624a593df7e92b06f5844e53a87a65c662aba4c.tar.gz
Tighten up recon middleware unit tests
Adds a test for get_expirer_info() and tightens up the test for get_async_info(). While reviewing [1] I noticed that the existing tests on master will not catch a bug creeping into the arg strings that these methods pass to from_recon_cache(). [1] https://review.openstack.org/#/c/163889 Change-Id: Iee6f12aeff684d70435dbeea769ccc181021be79
-rw-r--r--test/unit/common/middleware/test_recon.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/common/middleware/test_recon.py b/test/unit/common/middleware/test_recon.py
index 66e97c308..50abbd2d1 100644
--- a/test/unit/common/middleware/test_recon.py
+++ b/test/unit/common/middleware/test_recon.py
@@ -489,6 +489,9 @@ class TestReconSuccess(TestCase):
from_cache_response = {'async_pending': 5}
self.fakecache.fakeout = from_cache_response
rv = self.app.get_async_info()
+ self.assertEquals(self.fakecache.fakeout_calls,
+ [((['async_pending'],
+ '/var/cache/swift/object.recon'), {})])
self.assertEquals(rv, {'async_pending': 5})
def test_get_replication_info_account(self):
@@ -585,6 +588,17 @@ class TestReconSuccess(TestCase):
'/var/cache/swift/object.recon'), {})])
self.assertEquals(rv, {"object_updater_sweep": 0.79848217964172363})
+ def test_get_expirer_info_object(self):
+ from_cache_response = {'object_expiration_pass': 0.79848217964172363,
+ 'expired_last_pass': 99}
+ self.fakecache.fakeout_calls = []
+ self.fakecache.fakeout = from_cache_response
+ rv = self.app.get_expirer_info('object')
+ self.assertEquals(self.fakecache.fakeout_calls,
+ [((['object_expiration_pass', 'expired_last_pass'],
+ '/var/cache/swift/object.recon'), {})])
+ self.assertEquals(rv, from_cache_response)
+
def test_get_auditor_info_account(self):
from_cache_response = {"account_auditor_pass_completed": 0.24,
"account_audits_failed": 0,