Merge "Catch correct not found error in senlin plugin"
This commit is contained in:
commit
a95d77889d
@ -37,12 +37,12 @@ class SenlinClientPlugin(client_plugin.ClientPlugin):
|
||||
return client.Client(self.VERSION, **args)
|
||||
|
||||
def is_not_found(self, ex):
|
||||
return isinstance(ex, exc.HTTPNotFound)
|
||||
return isinstance(ex, exc.sdkexc.ResourceNotFound)
|
||||
|
||||
|
||||
class ProfileConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
expected_exceptions = (exc.HTTPNotFound,)
|
||||
expected_exceptions = (exc.sdkexc.ResourceNotFound,)
|
||||
|
||||
def validate_with_client(self, client, profile):
|
||||
client.client(CLIENT_NAME).get_profile(profile)
|
||||
|
@ -44,5 +44,6 @@ class ProfileConstraintTest(common.HeatTestCase):
|
||||
self.assertTrue(self.constraint.validate("PROFILE_ID", self.ctx))
|
||||
|
||||
def test_validate_false(self):
|
||||
self.mock_get_profile.side_effect = exc.HTTPNotFound
|
||||
self.mock_get_profile.side_effect = exc.sdkexc.ResourceNotFound(
|
||||
'PROFILE_ID')
|
||||
self.assertFalse(self.constraint.validate("PROFILE_ID", self.ctx))
|
||||
|
@ -137,7 +137,7 @@ class SenlinClusterTest(common.HeatTestCase):
|
||||
def test_cluster_delete_success(self):
|
||||
cluster = self._create_cluster(self.t)
|
||||
self.senlin_mock.get_cluster.side_effect = [
|
||||
exc.HTTPNotFound(),
|
||||
exc.sdkexc.ResourceNotFound('SenlinCluster'),
|
||||
]
|
||||
scheduler.TaskRunner(cluster.delete)()
|
||||
self.senlin_mock.delete_cluster.assert_called_once_with(
|
||||
|
Loading…
Reference in New Issue
Block a user