Merge "tests: Remove unnecessary API version overrides"

This commit is contained in:
Zuul
2025-08-12 11:31:16 +00:00
committed by Gerrit Code Review
36 changed files with 22 additions and 141 deletions
@@ -56,7 +56,6 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
api_samples_test_base.ApiSampleTestBase):
SUPPORTS_CELLS = False
api_major_version = 'v2'
# any additional fixtures needed for this scenario
_additional_fixtures = []
sample_dir = None
@@ -42,7 +42,7 @@ class TestCompareResult(test.NoDBTestCase):
ast_instance = api_samples_test_base.ApiSampleTestBase('setUp')
# required by ApiSampleTestBase
ast_instance.api_major_version = 'v2'
ast_instance.api_major_version = 'v2.1'
ast_instance.USE_PROJECT_ID = 'True'
# automagically create magic methods usually handled by test classes
@@ -280,7 +280,7 @@ class TestCompareResult(test.NoDBTestCase):
[
{
u'href':
(u'http://openstack.example.com/v2/%s/server/'
(u'http://openstack.example.com/v2.1/%s/server/'
'858f295a-8543-45fa-804a-08f8356d616d' %
api_samples_test_base.PROJECT_ID
),
@@ -327,7 +327,7 @@ class TestCompareResult(test.NoDBTestCase):
[
{
u'href':
(u'http://openstack.example.com/v2/openstack/server/'
(u'http://openstack.example.com/v2.1/openstack/server/'
'858f295a-8543-45fa-804a-08f8356d616d'),
u'rel': u'self'
},
@@ -368,7 +368,7 @@ class TestCompareResult(test.NoDBTestCase):
[
{
u'href':
(u'http://openstack.example.com/v2/openstack/server/'
(u'http://openstack.example.com/v2.1/openstack/server/'
'858f295a-8543-45fa-804a-08f8356d616d'),
u'rel': u'self'
},
@@ -18,7 +18,6 @@ from nova.tests.functional import api_samples_test_base
class FixedIpTest(api_samples_test_base.ApiSampleTestBase):
api_major_version = 'v2'
def test_fixed_ip_reserve(self):
ex = self.assertRaises(api_client.OpenStackApiException,
@@ -20,7 +20,6 @@ from nova.tests.functional import api_samples_test_base
class FpingSampleJsonTests(api_samples_test_base.ApiSampleTestBase):
api_major_version = 'v2'
def test_get_fping(self):
ex = self.assertRaises(api_client.OpenStackApiException,
@@ -19,7 +19,6 @@ from nova.tests.functional import api_samples_test_base
class VirtualInterfacesJsonTest(api_samples_test_base.ApiSampleTestBase):
api_major_version = 'v2'
def test_vifs_list(self):
uuid = uuids.instance_1
@@ -46,7 +46,6 @@ class FakeCinderError(object):
class LiveMigrationCinderFailure(integrated_helpers._IntegratedTestBase):
# Default self.api to the self.admin_api as live migration is admin only
ADMIN_API = True
api_major_version = 'v2.1'
microversion = 'latest'
def setUp(self):
@@ -56,10 +56,9 @@ def _verify_list_fulfillment(context, instance_uuid):
class VirtualInterfaceListMigrationTestCase(
integrated_helpers._IntegratedTestBase):
integrated_helpers._IntegratedTestBase
):
ADMIN_API = True
api_major_version = 'v2.1'
def setUp(self):
super(VirtualInterfaceListMigrationTestCase, self).setUp()
@@ -33,8 +33,6 @@ class LiveMigrationWithLockBase(
use it simultaneously. Every test using this mechanism should use
separate class instance.
"""
api_major_version = 'v2.1'
microversion = '2.74'
ADMIN_API = True
@@ -217,8 +215,6 @@ class LiveMigrationWithCpuSharedSet(
libvirt_base.ServersTestBase,
integrated_helpers.InstanceHelperMixin
):
api_major_version = 'v2.1'
# Microversion 2.74 is required to boot a server on a specific host,
# which is used in the below tests.
microversion = '2.74'
@@ -39,7 +39,6 @@ class NUMALiveMigrationBase(
"""Base for all the test classes here. Gives us the NUMATopologyFilter and
small helper methods.
"""
api_major_version = 'v2.1'
microversion = 'latest'
ADDITIONAL_FILTERS = ['NUMATopologyFilter']
ADMIN_API = True
@@ -436,8 +435,6 @@ class NUMALiveMigrationLegacyBase(NUMALiveMigrationPositiveBase):
live migration to go through (if forced through the API, thus bypassing the
scheduler).
"""
api_major_version = 'v2.1'
# NOTE(artom) After 2.67 we can no longer bypass the scheduler for live
# migration, which we need to do here to force the live migration to a host
# that's already full.
@@ -585,7 +582,6 @@ class NUMALiveMigrationNegativeTests(NUMALiveMigrationBase):
destination host (even if the scheduler was bypassed by forcing in the
API).
"""
api_major_version = 'v2.1'
# NOTE(artom) We're trying to test the new NUMA live migration claims, not
# the scheduler, so we use microversion 2.67, which is the last one where
# we can still bypass the scheduler and force a live migration to a host.
@@ -1106,9 +1106,6 @@ class NUMAServerTestWithCountingQuotaFromPlacement(NUMAServersTest):
class ReshapeForPCPUsTest(NUMAServersTestBase):
api_major_version = 'v2.1'
# TODO(stephenfin): We're using this because we want to be able to force
# the host during scheduling. We should instead look at overriding policy
ADMIN_API = True
@@ -27,11 +27,7 @@ LOG = logging.getLogger(__name__)
CONF = conf.CONF
class RescueServerTestWithDeletedBaseImage(
base.ServersTestBase
):
api_major_version = 'v2.1'
class RescueServerTestWithDeletedBaseImage(base.ServersTestBase):
microversion = '2.87'
# BUG #2002606
@@ -33,7 +33,6 @@ LOG = logging.getLogger(__name__)
class ServerSharesTestBase(base.ServersTestBase):
api_major_version = 'v2.1'
microversion = 'latest'
ADMIN_API = True
FAKE_LIBVIRT_VERSION = 8000000
@@ -36,9 +36,7 @@ LOG = logging.getLogger(__name__)
class VGPUTestBase(base.ServersTestBase):
# We want to target some hosts for some created instances
api_major_version = 'v2.1'
microversion = 'latest'
ADMIN_API = True
@@ -14,9 +14,8 @@ from nova.tests.functional.notification_sample_tests \
class TestKeypairNotificationSample(
notification_sample_base.NotificationSampleTestBase):
api_major_version = 'v2.1'
notification_sample_base.NotificationSampleTestBase
):
microversion = 'latest'
def test_keypair_create_delete(self):
@@ -29,7 +29,6 @@ class DeleteWithReservedVolumes(integrated_helpers._IntegratedTestBase):
The regression is that Nova would not clean up the reserved volumes and
the volume would be stuck in 'attaching' state.
"""
api_major_version = 'v2.1'
microversion = 'latest'
def _setup_compute_service(self):
@@ -30,7 +30,6 @@ class ResizeEvacuateTestCase(integrated_helpers._IntegratedTestBase):
# Set variables used in the parent class.
REQUIRES_LOCKING = False
ADMIN_API = True
api_major_version = 'v2.1'
microversion = '2.11' # Need at least 2.11 for the force-down API
def test_resize_then_evacuate(self):
@@ -27,7 +27,6 @@ class RebuildVolumeBackedSameImage(integrated_helpers._IntegratedTestBase):
API to see if the provided image_ref for rebuild is different than the
original image.
"""
api_major_version = 'v2.1'
# We need microversion <=2.93 to get the old BFV rebuild behavior
# that was the environment for this regression.
microversion = '2.92'
@@ -30,7 +30,6 @@ class MultiCellEvacuateTestCase(integrated_helpers._IntegratedTestBase):
NUMBER_OF_CELLS = 2
REQUIRES_LOCKING = False
ADMIN_API = True
api_major_version = 'v2.1'
microversion = '2.11' # Need at least 2.11 for the force-down API
def setUp(self):
@@ -23,7 +23,6 @@ class RebuildWithKeypairTestCase(integrated_helpers._IntegratedTestBase):
This tests a rebuild scenario with new key pairs.
"""
api_major_version = 'v2.1'
microversion = 'latest'
def test_rebuild_with_keypair(self):
@@ -14,7 +14,6 @@ from nova.tests.functional import integrated_helpers
class TestServices(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
microversion = 'latest'
def setUp(self):
@@ -15,10 +15,8 @@ from nova.tests.functional import integrated_helpers
class ComputeVersion5xPinnedRpcTests(integrated_helpers._IntegratedTestBase):
compute_driver = 'fake.MediumFakeDriver'
ADMIN_API = True
api_major_version = 'v2.1'
microversion = 'latest'
def setUp(self):
@@ -34,8 +34,6 @@ class TestLiveMigrateUpdateDevicePath(
Bug #1939545 covering the case where the returned path from os-brick
isn't being saved into the connection_info of the associated bdm in Nova.
"""
api_major_version = 'v2.1'
microversion = 'latest'
ADMIN_API = True
@@ -36,8 +36,6 @@ class TestRollbackWithHWOffloadedOVS(
that might cause the pre-live migration process to fail and
rollback_live_migration_at_source reproduce the device re-attach failure.
"""
api_major_version = 'v2.1'
microversion = 'latest'
ADMIN_API = True
@@ -22,10 +22,8 @@ from unittest import mock
class LibvirtDriverTests(
base.ServersTestBase,
integrated_helpers.InstanceHelperMixin
base.ServersTestBase, integrated_helpers.InstanceHelperMixin
):
api_major_version = 'v2.1'
microversion = 'latest'
def setUp(self):
@@ -20,8 +20,6 @@ from nova.tests.functional.libvirt import base
class Bug2007968RegressionTest(base.ServersTestBase):
"""Regression test for bug 2007968
"""
api_major_version = 'v2.1'
microversion = 'latest'
def setUp(self):
@@ -15,10 +15,8 @@ from nova.tests.functional import integrated_helpers
class ComputeVersion6xPinnedRpcTests(integrated_helpers._IntegratedTestBase):
compute_driver = 'fake.MediumFakeDriver'
ADMIN_API = True
api_major_version = 'v2.1'
microversion = 'latest'
def setUp(self):
-2
View File
@@ -25,7 +25,6 @@ CONF = nova.conf.CONF
class AggregatesTest(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2'
ADMIN_API = True
def _add_hosts_to_aggregate(self):
@@ -54,7 +53,6 @@ class AggregatesTest(integrated_helpers._IntegratedTestBase):
class AggregatesV281Test(AggregatesTest):
api_major_version = 'v2.1'
microversion = '2.81'
def setUp(self):
@@ -19,7 +19,6 @@ from nova.tests.functional import integrated_helpers
class FlavorExtraSpecsTest(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2'
def setUp(self):
super(FlavorExtraSpecsTest, self).setUp()
@@ -71,7 +70,6 @@ class FlavorExtraSpecsTest(integrated_helpers._IntegratedTestBase):
class FlavorExtraSpecsV286Test(FlavorExtraSpecsTest):
api_major_version = 'v2.1'
microversion = '2.86'
def test_create_invalid_spec(self):
@@ -25,7 +25,7 @@ from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
class InstanceActionsTestV2(integrated_helpers._IntegratedTestBase):
class InstanceActionsTest(integrated_helpers._IntegratedTestBase):
"""Tests Instance Actions API"""
def test_get_instance_actions(self):
@@ -41,11 +41,7 @@ class InstanceActionsTestV2(integrated_helpers._IntegratedTestBase):
server['id'])
class InstanceActionsTestV21(InstanceActionsTestV2):
api_major_version = 'v2.1'
class InstanceActionsTestV221(InstanceActionsTestV21):
class InstanceActionsTestV221(InstanceActionsTest):
microversion = '2.21'
def setUp(self):
@@ -75,7 +71,8 @@ class HypervisorError(Exception):
class InstanceActionEventFaultsTestCase(
test.TestCase, integrated_helpers.InstanceHelperMixin):
test.TestCase, integrated_helpers.InstanceHelperMixin
):
"""Tests for the instance action event details reporting from the API"""
def setUp(self):
-35
View File
@@ -1,35 +0,0 @@
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
from nova.tests.functional import integrated_helpers
LOG = logging.getLogger(__name__)
class LoginTest(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2'
def test_login(self):
# Simple check - we list flavors - so we know we're logged in.
flavors = self.api.get_flavors()
for flavor in flavors:
LOG.debug("flavor: %s", flavor)
class LoginTestV21(LoginTest):
api_major_version = 'v2.1'
@@ -22,8 +22,6 @@ class TestMultiattachVolumes(integrated_helpers._IntegratedTestBase):
Uses the CinderFixture fixture with a specific volume ID
to represent a multiattach volume.
"""
# These are all used in _IntegratedTestBase.
api_major_version = 'v2.1'
microversion = '2.60'
def setUp(self):
@@ -179,7 +179,6 @@ class NovaManageDBIronicTest(test.TestCase):
class TestIronicComputeNodeMove(NovaManageDBIronicTest):
"""Functional tests for "nova-manage db ironic_compute_node_move" CLI."""
api_major_version = 'v2.1'
def setUp(self):
super(TestIronicComputeNodeMove, self).setUp()
@@ -2120,7 +2119,6 @@ class TestNovaManagePlacementAudit(
class TestDBArchiveDeletedRows(integrated_helpers._IntegratedTestBase):
"""Functional tests for the "nova-manage db archive_deleted_rows" CLI."""
api_major_version = 'v2.1'
def setUp(self):
super(TestDBArchiveDeletedRows, self).setUp()
@@ -2167,7 +2165,6 @@ class TestDBArchiveDeletedRowsTaskLog(integrated_helpers._IntegratedTestBase):
"""Functional tests for the
"nova-manage db archive_deleted_rows --task-log" CLI.
"""
api_major_version = 'v2.1'
def setUp(self):
# Override time to ensure we cross audit period boundaries in a
@@ -38,7 +38,6 @@ CONF = cfg.CONF
class ServerGroupTestBase(test.TestCase,
integrated_helpers.InstanceHelperMixin):
REQUIRES_LOCKING = True
api_major_version = 'v2.1'
microversion = None
_enabled_filters = (CONF.filter_scheduler.enabled_filters +
@@ -581,7 +580,6 @@ class ServerGroupTestV21(ServerGroupTestBase):
class ServerGroupAffinityConfTest(ServerGroupTestBase):
api_major_version = 'v2.1'
# Load only anti-affinity filter so affinity will be missing
_enabled_filters = ['ServerGroupAntiAffinityFilter']
@@ -598,7 +596,6 @@ class ServerGroupAffinityConfTest(ServerGroupTestBase):
class ServerGroupAntiAffinityConfTest(ServerGroupTestBase):
api_major_version = 'v2.1'
# Load only affinity filter so anti-affinity will be missing
_enabled_filters = ['ServerGroupAffinityFilter']
@@ -615,7 +612,6 @@ class ServerGroupAntiAffinityConfTest(ServerGroupTestBase):
class ServerGroupSoftAffinityConfTest(ServerGroupTestBase):
api_major_version = 'v2.1'
microversion = '2.15'
soft_affinity = {'name': 'fake-name-4',
'policies': ['soft-affinity']}
@@ -638,7 +634,6 @@ class ServerGroupSoftAffinityConfTest(ServerGroupTestBase):
class ServerGroupSoftAntiAffinityConfTest(ServerGroupTestBase):
api_major_version = 'v2.1'
microversion = '2.15'
soft_anti_affinity = {'name': 'fake-name-3',
'policies': ['soft-anti-affinity']}
@@ -661,7 +656,6 @@ class ServerGroupSoftAntiAffinityConfTest(ServerGroupTestBase):
class ServerGroupTestV215(ServerGroupTestV21):
api_major_version = 'v2.1'
microversion = '2.15'
soft_anti_affinity = {'name': 'fake-name-3',
@@ -910,7 +904,6 @@ class ServerGroupTestV215(ServerGroupTestV21):
class ServerGroupTestV264(ServerGroupTestV215):
api_major_version = 'v2.1'
microversion = '2.64'
anti_affinity = {'name': 'fake-name-1', 'policy': 'anti-affinity'}
affinity = {'name': 'fake-name-2', 'policy': 'affinity'}
+8 -28
View File
@@ -889,7 +889,7 @@ class ServersTestV21(ServersTest):
class ServersTestV219(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
microversion = '2.19'
def _create_server(self, set_desc = True, desc = None):
server = self._build_server()
@@ -992,7 +992,6 @@ class ServersTestV219(integrated_helpers._IntegratedTestBase):
self.assertEqual(400, cm.exception.response.status_code)
def test_create_server_with_description(self):
self.api.microversion = '2.19'
# Create and get a server with a description
self._create_server_and_verify(True, 'test description')
# Create and get a server with an empty description
@@ -1003,7 +1002,6 @@ class ServersTestV219(integrated_helpers._IntegratedTestBase):
self._create_server_and_verify(False)
def test_update_server_with_description(self):
self.api.microversion = '2.19'
# Create a server with an initial description
server = self._create_server(True, 'test desc 1')[1]
server_id = server['id']
@@ -1023,8 +1021,6 @@ class ServersTestV219(integrated_helpers._IntegratedTestBase):
self._delete_server(server)
def test_rebuild_server_with_description(self):
self.api.microversion = '2.19'
# Create a server with an initial description
server = self._create_server(True, 'test desc 1')[1]
server_id = server['id']
@@ -1078,7 +1074,6 @@ class ServersTestV219(integrated_helpers._IntegratedTestBase):
self._create_assertRaisesRegex('test create 2.18')
def test_description_errors(self):
self.api.microversion = '2.19'
# Create servers with invalid descriptions. These throw 400.
# Invalid unicode with non-printable control char
self._create_assertRaisesRegex(u'invalid\0dstring')
@@ -1100,11 +1095,10 @@ class ServersTestV219(integrated_helpers._IntegratedTestBase):
class ServerTestV220(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
microversion = '2.20'
def setUp(self):
super(ServerTestV220, self).setUp()
self.api.microversion = '2.20'
self.ctxt = context.get_admin_context()
def _create_server(self):
@@ -1175,12 +1169,11 @@ class ServerTestV220(integrated_helpers._IntegratedTestBase):
class ServerTestV269(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
microversion = '2.69'
NUMBER_OF_CELLS = 3
def setUp(self):
super(ServerTestV269, self).setUp()
self.api.microversion = '2.69'
self.ctxt = context.get_admin_context()
self.project_id = self.api.project_id
@@ -1363,7 +1356,6 @@ class ServerTestV269(integrated_helpers._IntegratedTestBase):
# We get the results only from the up cells, this ignoring the down
# cells if list_records_by_skipping_down_cells config option is True.
self.admin_api = self.api_fixture.admin_api
self.admin_api.microversion = '2.69'
servers = self.admin_api.get_servers(
search_opts={'hostname': "cell3-inst0"})
self.assertEqual(1, len(servers))
@@ -1371,7 +1363,6 @@ class ServerTestV269(integrated_helpers._IntegratedTestBase):
def test_get_servers_detail_all_tenants_with_down_cells(self):
self.admin_api = self.api_fixture.admin_api
self.admin_api.microversion = '2.69'
servers = self.admin_api.get_servers(search_opts={'all_tenants': True})
# 4 servers from the up cells and 4 servers from the down cells
# plus the 2 instances from cell1 and cell3 which are in a different
@@ -1397,7 +1388,6 @@ class ServerTestV269(integrated_helpers._IntegratedTestBase):
class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
# We have to cap the microversion at 2.38 because that's the max we
# can use to update image metadata via our compute images proxy API.
microversion = '2.38'
@@ -1624,7 +1614,7 @@ class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase):
class ServerRebuildTestCaseV293(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
microversion = '2.93'
def setUp(self):
super(ServerRebuildTestCaseV293, self).setUp()
@@ -1651,7 +1641,6 @@ class ServerRebuildTestCaseV293(integrated_helpers._IntegratedTestBase):
return self._wait_for_state_change(server, 'ACTIVE')
def _test_rebuild(self, server):
self.api.microversion = '2.93'
# Now rebuild the server with a different image than was used to create
# our fake volume.
rebuild_image_ref = self.glance.auto_disk_config_enabled_image['id']
@@ -1708,18 +1697,9 @@ class ServerRebuildTestCaseV293(integrated_helpers._IntegratedTestBase):
class ServersTestV280(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
microversion = '2.80'
def setUp(self):
super(ServersTestV280, self).setUp()
self.api = self.api_fixture.api
self.admin_api = self.api_fixture.admin_api
self.api.microversion = '2.80'
self.admin_api.microversion = '2.80'
def test_get_migrations_after_cold_migrate_server_in_same_project(
self):
def test_get_migrations_after_cold_migrate_server_in_same_project(self):
# Create a server by non-admin
server = self.api.post_server({
'server': {
@@ -1751,7 +1731,8 @@ class ServersTestV280(integrated_helpers._IntegratedTestBase):
self.assertEqual([], migrations)
def test_get_migrations_after_live_migrate_server_in_different_project(
self):
self
):
# Create a server by non-admin
server = self.api.post_server({
'server': {
@@ -4860,7 +4841,6 @@ class TraitsBasedSchedulingTest(integrated_helpers.ProviderUsageBaseTestCase):
class ServerTestV256Common(integrated_helpers._IntegratedTestBase):
api_major_version = 'v2.1'
microversion = '2.56'
ADMIN_API = True
@@ -25,7 +25,6 @@ class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
os-interface API specifies a port ID created by Neutron.
"""
api_major_version = 'v2.1'
def test_detach_interface_negative_invalid_state(self):
# Create server with network
@@ -35,7 +35,6 @@ class ServersPreSchedulingTestCase(test.TestCase,
an in memory database for persistence. It does not allow requests to get
past scheduling.
"""
api_major_version = 'v2.1'
def setUp(self):
super(ServersPreSchedulingTestCase, self).setUp()