From cf1d3f87923820c35e985fd31e5ac977f927eaca Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 13 Dec 2016 15:22:49 -0800 Subject: [PATCH] Fix non-parameterized service id in hypervisors sample tests The hypervisors sample tests hard code the service id in the templates, which can vary (and will in a subsequent patch). This makes it parameterized so that it doesn't obsess over the actual value. Change-Id: I28ae3eb14aa1630deaf6f943c9ad78dc3c36c7b3 --- .../os-hypervisors/hypervisors-detail-resp.json.tpl | 2 +- .../os-hypervisors/hypervisors-show-resp.json.tpl | 2 +- .../os-hypervisors/v2.28/hypervisors-detail-resp.json.tpl | 2 +- .../os-hypervisors/v2.28/hypervisors-show-resp.json.tpl | 2 +- nova/tests/functional/api_sample_tests/test_hypervisors.py | 6 ++++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl index 73e0f8ba06..54be4d2c8f 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl @@ -20,7 +20,7 @@ "running_vms": 0, "service": { "host": "%(host_name)s", - "id": 2, + "id": "%(int:service_id)s", "disabled_reason": null }, "vcpus": 1, diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl index 61b18a3a98..29e9109290 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl @@ -19,7 +19,7 @@ "running_vms": 0, "service": { "host": "%(host_name)s", - "id": 2, + "id": "%(int:service_id)s", "disabled_reason": null }, "vcpus": 1, diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-detail-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-detail-resp.json.tpl index 6d51132137..9013accf7c 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-detail-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-detail-resp.json.tpl @@ -33,7 +33,7 @@ "running_vms": 0, "service": { "host": "%(host_name)s", - "id": 2, + "id": "%(int:service_id)s", "disabled_reason": null }, "vcpus": 1, diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-show-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-show-resp.json.tpl index 3bcf0b449e..7284a88dba 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-show-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.28/hypervisors-show-resp.json.tpl @@ -32,7 +32,7 @@ "running_vms": 0, "service": { "host": "%(host_name)s", - "id": 2, + "id": "%(int:service_id)s", "disabled_reason": null }, "vcpus": 1, diff --git a/nova/tests/functional/api_sample_tests/test_hypervisors.py b/nova/tests/functional/api_sample_tests/test_hypervisors.py index 8f0de6ca5f..0b14343a70 100644 --- a/nova/tests/functional/api_sample_tests/test_hypervisors.py +++ b/nova/tests/functional/api_sample_tests/test_hypervisors.py @@ -59,7 +59,8 @@ class HypervisorsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): def test_hypervisors_detail(self): hypervisor_id = '1' subs = { - 'hypervisor_id': hypervisor_id + 'hypervisor_id': hypervisor_id, + 'service_id': '[0-9]+', } response = self._do_get('os-hypervisors/detail') self._verify_response('hypervisors-detail-resp', subs, response, 200) @@ -67,7 +68,8 @@ class HypervisorsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): def test_hypervisors_show(self): hypervisor_id = '1' subs = { - 'hypervisor_id': hypervisor_id + 'hypervisor_id': hypervisor_id, + 'service_id': '[0-9]+', } response = self._do_get('os-hypervisors/%s' % hypervisor_id) self._verify_response('hypervisors-show-resp', subs, response, 200)