Fix swift functional test "test_create_store"

Fix "test_create_store" when a real swift store is used
via the GLANCE_TEST_SWIFT_CONF environment variable.

Fixes bug: 1292170
Change-Id: I500c1d0caee30449146b732b1105b20b7a0d5d05
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
This commit is contained in:
Zhi Yan Liu 2014-03-15 03:00:02 +08:00 committed by Gerrit Code Review
parent 11b1a7ffb7
commit 4617f058c0
3 changed files with 6 additions and 4 deletions

View File

@ -63,7 +63,9 @@ REGISTERED_STORES = set()
CONF = cfg.CONF
CONF.register_opts(store_opts)
_EXTRA_STORES = [
_ALL_STORES = [
'glance.store.filesystem.Store',
'glance.store.http.Store',
'glance.store.rbd.Store',
'glance.store.s3.Store',
'glance.store.swift.Store',
@ -179,7 +181,7 @@ def create_stores():
"""
store_count = 0
store_classes = set()
for store_entry in (CONF.known_stores + _EXTRA_STORES):
for store_entry in set(CONF.known_stores + _ALL_STORES):
store_entry = store_entry.strip()
if not store_entry:
continue

View File

@ -69,7 +69,7 @@ class BaseTestCase(object):
def test_create_store(self):
self.config(known_stores=[self.store_cls_path])
count = glance.store.create_stores()
self.assertEqual(count, 7)
self.assertEqual(8, count)
def test_lifecycle(self):
"""Add, get and delete an image"""

View File

@ -56,4 +56,4 @@ class TestStoreBase(test_base.StoreClearingUnitTest):
"glance.tests.unit.test_store_base.FakeUnconfigurableStoreDriver",
"glance.store.filesystem.Store"])
count = store.create_stores()
self.assertEqual(count, 8)
self.assertEqual(9, count)