Using max api version in notification sample test

Notification payloads always reflect the data needed for every
supported API microversion so we can safely use the latest
API version in the notification sample tests. This helps the test
to use the new API features too.

Change-Id: I851bd2e7ef13a1efa4fed4176996d71f6e2de94a
This commit is contained in:
Béla Vancsics 2017-03-21 15:01:02 +01:00 committed by Matt Riedemann
parent 1cbe4d4560
commit c2d38a50ba
2 changed files with 13 additions and 1 deletions

View File

@ -61,6 +61,15 @@ class NotificationSampleTestBase(test.TestCase,
self.api = api_fixture.api
self.admin_api = api_fixture.admin_api
# NOTE(gibi): Notification payloads always reflect the data needed
# for every supported API microversion so we can safe to use the latest
# API version in the tests. This helps the test to use the new API
# features too.
max_version = 'latest'
self.api.microversion = max_version
self.admin_api.microversion = max_version
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
@ -156,6 +165,10 @@ class NotificationSampleTestBase(test.TestCase,
image_uuid='155d900f-4e14-4e4c-a73d-069cbf4541e6',
flavor_id=flavor_id)
# NOTE(gibi): from microversion 2.19 the description is not set to the
# instance name automatically but can be provided at boot.
server['description'] = 'some-server'
if extra_params:
extra_params['return_reservation_id'] = True
server.update(extra_params)

View File

@ -58,7 +58,6 @@ class TestServiceUpdateNotificationSample(
body = {'host': 'host1',
'binary': 'nova-compute',
'forced_down': True}
self.admin_api.microversion = '2.12'
self.admin_api.api_put('os-services/force-down', body)
self._verify_notification('service-update',
replacements={'forced_down': True,