Fix tests when CONF.set_override with enforce_type=True

Oslo.config make CONF.set_override with enforce_type=True by default
in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0 and
I5b62427495179edb7672c6e5c508037f8b9d0b84, these changes break Glance's
tests[1], this commit fixes failures:

* Method config will raise ValueError in oslo.config 4.0 , so add it
  in expected exception list,

* Oslo.config ensures option 'location_strategy' only allow two values,
  so remove invalid test.

[1] http://logs.openstack.org/periodic/periodic-glance-py35-with-oslo-master/290de5d/testr_results.html.gz

Related-Bug: #1517839

Change-Id: I366042c7a739e74c270ae8cc7eca047a23ea2dd9
This commit is contained in:
ChangBo Guo(gcb) 2017-04-16 14:09:02 +08:00
parent 085f375a13
commit d1020785dc
2 changed files with 2 additions and 8 deletions

View File

@ -58,7 +58,8 @@ logging.register_options(CONF)
KNOWN_EXCEPTIONS = (RuntimeError,
exception.WorkerCreationFailure,
glance_store.exceptions.BadStoreConfiguration)
glance_store.exceptions.BadStoreConfiguration,
ValueError)
def fail(e):

View File

@ -107,13 +107,6 @@ class TestLocationStrategy(base.IsolatedUnitTest):
self.config(location_strategy=strategy_name)
location_strategy.verify_location_strategy()
def test_verify_invalid_location_strategy(self):
strategy = 'invalid_strategy'
self.config(location_strategy=strategy)
self.assertRaises(RuntimeError,
location_strategy.verify_location_strategy,
strategy)
def test_get_ordered_locations_with_none_or_empty_locations(self):
self.assertEqual([], location_strategy.get_ordered_locations(None))
self.assertEqual([], location_strategy.get_ordered_locations([]))