Make sure microversion < 2.62 does not show host(Id) for instance actions

This adds a simple assertion that when microversion < 2.62, the
"nova instance-action" CLI does not show host or hostId output.

Related to blueprint add-host-to-instance-action-events

Change-Id: I6e0866d9daff75046a5e82f57ff745d494b4b5ed
This commit is contained in:
Matt Riedemann 2018-04-27 10:19:12 -04:00
parent 5483be7fe7
commit 460638436e
1 changed files with 10 additions and 0 deletions

View File

@ -66,6 +66,8 @@ class TestInstanceActionCLIV258(TestInstanceActionCLI):
"""Instance action functional tests for v2.58 nova-api microversion."""
COMPUTE_API_VERSION = "2.58"
# Does this microversion return a hostId field in the event response?
expect_event_hostId_field = False
def test_list_instance_action_with_marker_and_limit(self):
server = self._create_server()
@ -86,6 +88,13 @@ class TestInstanceActionCLIV258(TestInstanceActionCLI):
action = self._get_list_of_values_from_single_column_table(
output, "Action")
self.assertEqual(action, ['create'])
if not self.expect_event_hostId_field:
# Make sure host and hostId are not in the response when
# microversion is less than 2.62.
output = self.nova("instance-action %s %s" % (
server.id, marker_req))
self.assertNotIn("'host'", output)
self.assertNotIn("'hostId'", output)
def test_list_instance_action_with_changes_since(self):
# Ignore microseconds to make this a deterministic test.
@ -120,6 +129,7 @@ class TestInstanceActionCLIV262(TestInstanceActionCLIV258,
"""Instance action functional tests for v2.62 nova-api microversion."""
COMPUTE_API_VERSION = "2.62"
expect_event_hostId_field = True
def test_show_actions_with_host(self):
name = self.name_generate()