From 70dbb01ea3ed900a41092d46ed5ae1370d5771af Mon Sep 17 00:00:00 2001 From: Daniel Wilson Date: Sat, 12 Nov 2022 11:08:03 -0500 Subject: Use the SDK for server show Use the SDK for the server show command. This change modifies a helper function that is used by server show as well as other commands that print information about an individual server. The helper still uses novaclient APIs when additional OpenStack requests are needed since some of its callers are still using the nova client. Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/864340 Change-Id: Ic253184ee5f911ec2052419d328260dc4664b273 --- .../tests/functional/compute/v2/test_server.py | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'openstackclient/tests/functional') diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py index 830b3543..106918d5 100644 --- a/openstackclient/tests/functional/compute/v2/test_server.py +++ b/openstackclient/tests/functional/compute/v2/test_server.py @@ -11,6 +11,7 @@ # under the License. import itertools +import json import time import uuid @@ -288,6 +289,33 @@ class ServerTests(common.ComputeTestCase): ) self.assertOutput("", raw_output) + def test_server_show(self): + """Test server show""" + cmd_output = self.server_create() + name = cmd_output['name'] + + # Simple show + cmd_output = json.loads(self.openstack( + f'server show -f json {name}' + )) + self.assertEqual( + name, + cmd_output["name"], + ) + + # Show diagnostics + cmd_output = json.loads(self.openstack( + f'server show -f json {name} --diagnostics' + )) + self.assertIn('driver', cmd_output) + + # Show topology + cmd_output = json.loads(self.openstack( + f'server show -f json {name} --topology ' + f'--os-compute-api-version 2.78' + )) + self.assertIn('topology', cmd_output) + def test_server_actions(self): """Test server action pairs -- cgit v1.2.1