fix: test determining latest API version

The point of this test is that the server is suppose to advertise
something large and we are suppose to check that the client is clamping
down to the maximum supported version. In e2ffecc8a the change was made
to the current version which defeated the goal of the test so increase
this value to something much higher for the test to take effect and do
it programmatically to ensure this doesn't happen again.

Change-Id: I570fab0e590755a4ee77bed1ddb06234e1b6786e
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
This commit is contained in:
Doug Goldstein
2026-01-14 15:25:15 -06:00
parent 924107bcd2
commit 8a1ff4fc27

View File

@@ -204,8 +204,16 @@ class VersionNegotiationMixinTest(utils.BaseTestCase):
autospec=True)
def test_negotiate_version_server_user_latest(
self, mock_pvh, mock_msr, mock_save_data):
# For the test to work we need to have the mock reply
# with a version range that exceeds the client version
# otherwise we are not confirming that the client is
# clamping the version correctly
large_value = http.LAST_KNOWN_API_VERSION + 99
# have to retry with simple get
mock_pvh.side_effect = iter([(None, None), ('1.1', '1.104')])
mock_pvh.side_effect = iter([
(None, None),
('1.1', f"1.{large_value}")
])
mock_conn = mock.MagicMock()
self.test_object.api_version_select_state = 'user'
self.test_object.os_ironic_api_version = 'latest'