Handle func tests of swift cluster that hide /info

If a swift cluster configures the proxy server to not accept
/info requests, just do the best we can, skipping tests as
necessary.

To that end, if cors mode is not known we also skip the test.

Change-Id: I34f296c8717e0baf24ae552a7e38f9354ee91974
This commit is contained in:
Peter Portante 2014-06-02 13:36:21 -04:00 committed by Samuel Merritt
parent ea61632e1f
commit 0753dd3923
2 changed files with 12 additions and 6 deletions

View File

@ -347,7 +347,13 @@ def get_cluster_info():
# test.conf data
pass
else:
eff_constraints.update(cluster_info.get('swift', {}))
try:
eff_constraints.update(cluster_info['swift'])
except KeyError:
# Most likely the swift cluster has "expose_info = false" set
# in its proxy-server.conf file, so we'll just do the best we
# can.
print >>sys.stderr, "** Swift Cluster not exposing /info **"
# Finally, we'll allow any constraint present in the swift-constraints
# section of test.conf to override everything. Note that only those

View File

@ -916,6 +916,11 @@ class TestObject(unittest.TestCase):
if tf.skip:
raise SkipTest
try:
strict_cors = tf.cluster_info['swift']['strict_cors_mode']
except KeyError:
raise SkipTest("cors mode is unknown")
def put_cors_cont(url, token, parsed, conn, orig):
conn.request(
'PUT', '%s/%s' % (parsed.path, self.container),
@ -989,11 +994,6 @@ class TestObject(unittest.TestCase):
resp.read()
self.assertEquals(resp.status, 401)
try:
strict_cors = tf.cluster_info['swift']['strict_cors_mode']
except KeyError:
strict_cors = False
if strict_cors:
resp = retry(check_cors,
'GET', 'cat', {'Origin': 'http://m.com'})