From e74f2d94fe5edfcb2b163851d85c202be5eaa309 Mon Sep 17 00:00:00 2001 From: devMuscle Date: Sun, 26 Mar 2023 13:08:49 +0900 Subject: "hypervisor list --matching" showed the wrong result Previously, using the "--matching" option shows empty results. Previously, the "--matching" option called the "find_hypervisor method", so we used to call the "hypervisor method" like any other "--limit, --marker" options. Depending on the nova api version, the api that is basically called is as follows 2.53 >= : /os-hypervisors/detail?hypervisor_hostname_pattern=$HOSTNAME 2.53 < : /os-hypervisors/{pattern}/search Hypervisor Type and Host IP are not returned when using microversion 2.52 or lower Co-authored-by: Jipyo Hong Co-authored-by: Jieon Lee Co-authored-by: YoonSoo LIM story: 2010670 task: 47726 Change-Id: I7b47acf48def7d4c5f4b74e4dba1c23d8ac7abf2 --- openstackclient/tests/unit/compute/v2/test_hypervisor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/unit/compute/v2/test_hypervisor.py b/openstackclient/tests/unit/compute/v2/test_hypervisor.py index e5804665..ab14072d 100644 --- a/openstackclient/tests/unit/compute/v2/test_hypervisor.py +++ b/openstackclient/tests/unit/compute/v2/test_hypervisor.py @@ -131,7 +131,8 @@ class TestHypervisorList(TestHypervisor): parsed_args = self.check_parser(self.cmd, arglist, verifylist) # Fake the return value of search() - self.sdk_client.find_hypervisor.return_value = [self.hypervisors[0]] + self.sdk_client.hypervisors.return_value = [self.hypervisors[0]] + self.data = ( ( self.hypervisors[0].id, @@ -147,10 +148,9 @@ class TestHypervisorList(TestHypervisor): # containing the data to be listed. columns, data = self.cmd.take_action(parsed_args) - self.sdk_client.find_hypervisor.assert_called_with( - self.hypervisors[0].name, - ignore_missing=False - ) + self.sdk_client.hypervisors.assert_called_with( + hypervisor_hostname_pattern=self.hypervisors[0].name, + details=True) self.assertEqual(self.columns, columns) self.assertEqual(self.data, tuple(data)) @@ -164,7 +164,7 @@ class TestHypervisorList(TestHypervisor): parsed_args = self.check_parser(self.cmd, arglist, verifylist) # Fake exception raised from search() - self.sdk_client.find_hypervisor.side_effect = \ + self.sdk_client.hypervisors.side_effect = \ exceptions.NotFound(None) self.assertRaises(exceptions.NotFound, -- cgit v1.2.1