summaryrefslogtreecommitdiff
path: root/test/unit/proxy/controllers/test_base.py
diff options
context:
space:
mode:
authorPaul Luse <paul.e.luse@intel.com>2014-07-02 14:39:42 -0700
committerJohn Dickinson <me@not.mn>2014-07-02 21:18:10 -0700
commitbfa9139649c0ac7f75e8c9503cb04d06f7bae0b9 (patch)
treee01b12d2f9061cb7345701727736327bed7c236d /test/unit/proxy/controllers/test_base.py
parent7dbf8324569d45897f2b4f05cd97299366eff23d (diff)
downloadswift-proposed/2.0.0.tar.gz
Fix potential missing key error in container_info2.0.0.rc22.0.0proposed/2.0.0
If upgrading from a non-storage policy enabled version of swift to a storage policy enabled version its possible that memcached will have an info structure that does not contain the 'storage_policy" key resulting in an unhandled exception during the lookup. The fix is to simply make sure we never return the dict without a storage_policy key defined; if it doesn't exist its safe to make it '0' as this means you're in the update scenario and there's xno other possibility. Change-Id: If8c88f67ba7a3180ad06b586372fe35c65807aac
Diffstat (limited to 'test/unit/proxy/controllers/test_base.py')
-rw-r--r--test/unit/proxy/controllers/test_base.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/unit/proxy/controllers/test_base.py b/test/unit/proxy/controllers/test_base.py
index 2c150e1c0..51b104f15 100644
--- a/test/unit/proxy/controllers/test_base.py
+++ b/test/unit/proxy/controllers/test_base.py
@@ -315,6 +315,7 @@ class TestFuncs(unittest.TestCase):
req = Request.blank("/v1/AUTH_account/cont",
environ={'swift.cache': FakeCache({})})
resp = get_container_info(req.environ, FakeApp())
+ self.assertEquals(resp['storage_policy'], '0')
self.assertEquals(resp['bytes'], 6666)
self.assertEquals(resp['object_count'], 1000)
@@ -342,6 +343,7 @@ class TestFuncs(unittest.TestCase):
req = Request.blank("/v1/account/cont",
environ={'swift.cache': FakeCache(cache_stub)})
resp = get_container_info(req.environ, FakeApp())
+ self.assertEquals(resp['storage_policy'], '0')
self.assertEquals(resp['bytes'], 3333)
self.assertEquals(resp['object_count'], 10)
self.assertEquals(resp['status'], 404)