From c2d38a50bac4503089ce5d9a1f919e5e0a86021f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9la=20Vancsics?= Date: Tue, 21 Mar 2017 15:01:02 +0100 Subject: [PATCH] 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 --- .../notification_sample_base.py | 13 +++++++++++++ .../test_service_update.py | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/nova/tests/functional/notification_sample_tests/notification_sample_base.py b/nova/tests/functional/notification_sample_tests/notification_sample_base.py index 44517a205a..596f1ab8c5 100644 --- a/nova/tests/functional/notification_sample_tests/notification_sample_base.py +++ b/nova/tests/functional/notification_sample_tests/notification_sample_base.py @@ -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) diff --git a/nova/tests/functional/notification_sample_tests/test_service_update.py b/nova/tests/functional/notification_sample_tests/test_service_update.py index a0e81a631a..87ead09bb0 100644 --- a/nova/tests/functional/notification_sample_tests/test_service_update.py +++ b/nova/tests/functional/notification_sample_tests/test_service_update.py @@ -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,