Fix TestListMigrationV223 test class MIGRATION_COLUMNS

Currently only the test_server_migration_list adds the 'Id' and 'Type'
columns to the expected output, so if the
test_server_migration_list_no_options test is run by itself, it fails
as the actual response contains 'Id' and 'Type' but the reference does
not. This example run fails:

  tox -epy38 test_server_migration_list_no_options

The reason the tests pass in the gate is because
test_server_migration_list (which adds the 'Id' and 'Type' columns to
self.MIGRATION_COLUMNS) appears to always run before
test_server_migration_list_no_options, so the latter test gets the
benefit of the former test's column additions.

This changes the test class to just include the 'Id' and 'Type' columns
all the time as they are always returned in microversion 2.23 anyway.

Story: 2009079
Task: 42891

Change-Id: I2c97e9f64790b5e978e4d04230d45b8e343b53d4
This commit is contained in:
melanie witt
2021-07-27 02:10:20 +00:00
parent c1209601b4
commit 4f6fe1c0fd

View File

@@ -4977,9 +4977,9 @@ class TestListMigrationV223(TestListMigration):
"""Test fetch all migrations. """
MIGRATION_COLUMNS = [
'Source Node', 'Dest Node', 'Source Compute',
'Dest Compute', 'Dest Host', 'Status', 'Server UUID',
'Old Flavor', 'New Flavor', 'Created At', 'Updated At'
'Id', 'Source Node', 'Dest Node', 'Source Compute', 'Dest Compute',
'Dest Host', 'Status', 'Server UUID', 'Old Flavor', 'New Flavor',
'Type', 'Created At', 'Updated At'
]
def setUp(self):
@@ -5006,9 +5006,6 @@ class TestListMigrationV223(TestListMigration):
self.migrations_mock.list.assert_called_with(**kwargs)
self.MIGRATION_COLUMNS.insert(0, "Id")
self.MIGRATION_COLUMNS.insert(
len(self.MIGRATION_COLUMNS) - 2, 'Type')
self.assertEqual(self.MIGRATION_COLUMNS, columns)
self.assertEqual(tuple(self.data), tuple(data))