From ead5eb2507dfabc2ad038ee45f182325adaf4483 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 20 Sep 2019 13:53:57 +0100 Subject: [PATCH] nova-net: Migrate 'test_hypervisors' functional tests There's one less service with nova-network disabled, meaning the host indexes are off by one. We just use a regex sub to avoid needing to change this. Change-Id: I5c8496f7287634a0db50f4545c43aeba33b75e6b Signed-off-by: Stephen Finucane --- .../os-hypervisors/v2.33/hypervisors-detail-resp.json.tpl | 2 +- nova/tests/functional/api_sample_tests/test_hypervisors.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.33/hypervisors-detail-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.33/hypervisors-detail-resp.json.tpl index 0cf1745bf3fa..e927fe433f7e 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.33/hypervisors-detail-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-hypervisors/v2.33/hypervisors-detail-resp.json.tpl @@ -33,7 +33,7 @@ "running_vms": 0, "service": { "host": "%(host_name)s", - "id": 6, + "id": "%(int:service_id)s", "disabled_reason": null }, "vcpus": 2, diff --git a/nova/tests/functional/api_sample_tests/test_hypervisors.py b/nova/tests/functional/api_sample_tests/test_hypervisors.py index 9327bbde7de7..ce4ca354d30f 100644 --- a/nova/tests/functional/api_sample_tests/test_hypervisors.py +++ b/nova/tests/functional/api_sample_tests/test_hypervisors.py @@ -101,7 +101,6 @@ class HypervisorsSampleJson228Tests(HypervisorsSampleJsonTests): class HypervisorsSampleJson233Tests(api_sample_base.ApiSampleTestBaseV21): - USE_NEUTRON = False ADMIN_API = True sample_dir = "os-hypervisors" microversion = '2.33' @@ -119,12 +118,12 @@ class HypervisorsSampleJson233Tests(api_sample_base.ApiSampleTestBaseV21): response = self._do_get('os-hypervisors?limit=1&marker=1') self._verify_response('hypervisors-list-resp', {}, response, 200) - # TODO(stephenfin): Migrate off of nova-network def test_hypervisors_detail(self): subs = { 'hypervisor_id': '2', 'host': 'host1', - 'host_name': 'host1' + 'host_name': 'host1', + 'service_id': '[0-9]+', } response = self._do_get('os-hypervisors/detail?limit=1&marker=1') self._verify_response('hypervisors-detail-resp', subs, response, 200)