summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional
diff options
context:
space:
mode:
authorDaniel Wilson <danielcw@bu.edu>2022-11-12 11:08:03 -0500
committerDaniel Wilson <danielcw@bu.edu>2022-12-11 18:04:29 -0500
commit70dbb01ea3ed900a41092d46ed5ae1370d5771af (patch)
tree83d88aeaa9bc30eeef6ea8ea62b023d888f5b3f8 /openstackclient/tests/functional
parent10453e085f050c497c37b95e0c67d71df8633a2f (diff)
downloadpython-openstackclient-70dbb01ea3ed900a41092d46ed5ae1370d5771af.tar.gz
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
Diffstat (limited to 'openstackclient/tests/functional')
-rw-r--r--openstackclient/tests/functional/compute/v2/test_server.py28
1 files changed, 28 insertions, 0 deletions
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