Fix cleaning action plan resources on watcher
The resource of action plan has not name attribute, we should return base.NoName instance in resources cleanup, and we can fix watcher ci. Change-Id: I1e3c3865d8d869dae1998853b8288e5c8c39452e
This commit is contained in:
parent
c2f7d99696
commit
01347f15b5
2
rally/plugins/openstack/cleanup/resources.py
Executable file → Normal file
2
rally/plugins/openstack/cleanup/resources.py
Executable file → Normal file
@ -911,7 +911,7 @@ class WatcherTemplate(WatcherMixin):
|
||||
class WatcherActionPlan(WatcherMixin):
|
||||
|
||||
def name(self):
|
||||
return self.raw_resource.uuid
|
||||
return base.NoName(self._resource)
|
||||
|
||||
|
||||
@base.resource("watcher", "audit", order=next(_watcher_order),
|
||||
|
3
tests/unit/plugins/openstack/cleanup/test_resources.py
Executable file → Normal file
3
tests/unit/plugins/openstack/cleanup/test_resources.py
Executable file → Normal file
@ -1049,8 +1049,7 @@ class WatcherActionPlanTestCase(test.TestCase):
|
||||
|
||||
def test_name(self):
|
||||
watcher = resources.WatcherActionPlan()
|
||||
watcher.raw_resource = mock.MagicMock(uuid="name")
|
||||
self.assertEqual("name", watcher.name())
|
||||
self.assertIsInstance(watcher.name(), resources.base.NoName)
|
||||
|
||||
@mock.patch("%s.WatcherActionPlan._manager" % BASE)
|
||||
def test_is_deleted(self, mock__manager):
|
||||
|
Loading…
x
Reference in New Issue
Block a user