summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional
diff options
context:
space:
mode:
authormelanie witt <melwittt@gmail.com>2020-07-27 22:04:47 +0000
committermelanie witt <melwittt@gmail.com>2020-08-27 20:24:48 +0000
commit4a3c5207c1b2d628d1ec8b30e28f56e5956bd2e0 (patch)
tree2ec328cb0b0de667c1b8cce209e9f817cfc59ae7 /openstackclient/tests/functional
parent82ebddca006d1dc61855fdd34b0616222039ea58 (diff)
downloadpython-openstackclient-4a3c5207c1b2d628d1ec8b30e28f56e5956bd2e0.tar.gz
Show words indicating booted from volume for server image
For a server booted from a volume, nova API does not store an image_id and instead returns an empty string. Currently, openstackclient similarly shows an empty string for Image Name and Image ID for servers booted from volumes. To aid CLI users in understanding the meaning of no image_id, we can display the string "N/A (booted from volume)" in the image field if the server was booted from a volume. Change-Id: I9c62cf6fe23b2e934dcbf5ebbf706b2705d2e424
Diffstat (limited to 'openstackclient/tests/functional')
-rw-r--r--openstackclient/tests/functional/compute/v2/test_server.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py
index 6e080e9b..3123057c 100644
--- a/openstackclient/tests/functional/compute/v2/test_server.py
+++ b/openstackclient/tests/functional/compute/v2/test_server.py
@@ -16,6 +16,7 @@ import uuid
from tempest.lib import exceptions
+from openstackclient.compute.v2 import server as v2_server
from openstackclient.tests.functional.compute.v2 import common
from openstackclient.tests.functional.volume.v2 import common as volume_common
@@ -509,6 +510,20 @@ class ServerTests(common.ComputeTestCase):
server['name'],
)
+ # check that image indicates server "booted from volume"
+ self.assertEqual(
+ v2_server.IMAGE_STRING_FOR_BFV,
+ server['image'],
+ )
+ # check server list too
+ servers = json.loads(self.openstack(
+ 'server list -f json'
+ ))
+ self.assertEqual(
+ v2_server.IMAGE_STRING_FOR_BFV,
+ servers[0]['Image']
+ )
+
# check volumes
cmd_output = json.loads(self.openstack(
'volume show -f json ' +
@@ -779,8 +794,8 @@ class ServerTests(common.ComputeTestCase):
self.addCleanup(self.openstack, 'volume delete ' + attached_volume_id)
# Since the server is volume-backed the GET /servers/{server_id}
- # response will have image=''.
- self.assertEqual('', cmd_output['image'])
+ # response will have image='N/A (booted from volume)'.
+ self.assertEqual(v2_server.IMAGE_STRING_FOR_BFV, cmd_output['image'])
# check the volume that attached on server
cmd_output = json.loads(self.openstack(