From e8192177e8d7de1aac40ed9f5369e2c7e62eea8f Mon Sep 17 00:00:00 2001 From: Kevin_Zheng Date: Wed, 11 Jul 2018 12:11:36 +0800 Subject: [PATCH] Fix ServerMigrationSampleJsonTestsV2_24 to use its own sample file The ServerMigrationSampleJsonTestsV2_24 functional tests set up ``self.api.microversion`` to 2.24 in its' setUp(), by doing this it will not need to add its' own sample files, as there will be no difference anyway. But this makes Tests that inherent from this test class impossibe to run as the microversion will always been overriden. This patch fix it by change the tests to use self.microversion and adds its' own sample files. Part of blueprint abort-live-migration-in-queued-status Change-Id: I07222efb8d566fa1dd395ef948eae6e6c4b13678 --- .../server-migrations/v2.24/live-migrate-server.json | 7 +++++++ .../server-migrations/v2.24/live-migrate-server.json.tpl | 7 +++++++ .../functional/api_sample_tests/test_server_migrations.py | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 doc/api_samples/server-migrations/v2.24/live-migrate-server.json create mode 100644 nova/tests/functional/api_sample_tests/api_samples/server-migrations/v2.24/live-migrate-server.json.tpl diff --git a/doc/api_samples/server-migrations/v2.24/live-migrate-server.json b/doc/api_samples/server-migrations/v2.24/live-migrate-server.json new file mode 100644 index 000000000000..251863d7855e --- /dev/null +++ b/doc/api_samples/server-migrations/v2.24/live-migrate-server.json @@ -0,0 +1,7 @@ +{ + "os-migrateLive": { + "host": "01c0cadef72d47e28a672a76060d492c", + "block_migration": false, + "disk_over_commit": false + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/server-migrations/v2.24/live-migrate-server.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/server-migrations/v2.24/live-migrate-server.json.tpl new file mode 100644 index 000000000000..4800d4aa1110 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/server-migrations/v2.24/live-migrate-server.json.tpl @@ -0,0 +1,7 @@ +{ + "os-migrateLive": { + "host": "%(hostname)s", + "block_migration": false, + "disk_over_commit": false + } +} diff --git a/nova/tests/functional/api_sample_tests/test_server_migrations.py b/nova/tests/functional/api_sample_tests/test_server_migrations.py index 4a5ee20b2509..4b9966fdb558 100644 --- a/nova/tests/functional/api_sample_tests/test_server_migrations.py +++ b/nova/tests/functional/api_sample_tests/test_server_migrations.py @@ -163,13 +163,13 @@ class ServerMigrationsSamplesJsonTestV2_23(test_servers.ServersSampleBase): class ServerMigrationsSampleJsonTestV2_24(test_servers.ServersSampleBase): ADMIN_API = True + microversion = '2.24' sample_dir = "server-migrations" scenarios = [('v2_24', {'api_major_version': 'v2.1'})] def setUp(self): """setUp method for server usage.""" super(ServerMigrationsSampleJsonTestV2_24, self).setUp() - self.api.microversion = '2.24' self.uuid = self._post_server() self.context = context.RequestContext('fake', 'fake') fake_migration = {