Handle SDK changes

stable/queens allows SDK >=0.9.19 and <=0.11.3.  Somewhere in there the
return text of an exception changed.

Backport portions of Id6de1485bcafb41f238f3e74277094ce64a6acf4 to handle
this change, but modify to work with either text form sice both are allowed.

Change-Id: Ibfee8e1e2ae4eca763894bbee8747297e0fb350f
This commit is contained in:
Dean Troyer 2018-03-13 11:39:35 -05:00
parent 6076808192
commit aeda2fb6a5
1 changed files with 8 additions and 1 deletions

View File

@ -105,7 +105,14 @@ class ExtensionTests(base.TestCase):
try:
self.openstack('extension show ' + name)
except tempest_exc.CommandFailed as e:
self.assertIn('ResourceNotFound', str(e))
# NOTE(dtroyer): We have to test for both strings because the
# change in the SDK between 0.9.19 and 0.11.x
# spans our allowed range in stable/queens.
not_found = (
'ResourceNotFound' in str(e) or
'No Extension found for' in str(e)
)
self.assertTrue(not_found)
self.assertIn(name, str(e))
else:
self.fail('CommandFailed should be raised')