Skip to content

Commit 239ffff

Browse files
committed
Add a regression test for 5.12 compute API issue
In I147bf4d95e6d86ff1f967a8ce37260730f21d236 we wrote a breaking RPC change for the 5.12 version as the accel_uuids parameter is not optional. Adding a regression test to check the issue. Change-Id: I1f3914e16294c99a625b3984ca0098d835cd9b92 Related-Bug: #1902925 (cherry picked from commit 8f79afd)
1 parent 61717ff commit 239ffff

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
from nova.tests.functional.api import client
13+
from nova.tests.functional import integrated_helpers
14+
from nova.tests.unit import cast_as_call
15+
16+
17+
class ComputeVersion5xPinnedRpcTests(integrated_helpers._IntegratedTestBase):
18+
19+
compute_driver = 'fake.MediumFakeDriver'
20+
ADMIN_API = True
21+
api_major_version = 'v2.1'
22+
microversion = 'latest'
23+
24+
def setUp(self):
25+
super(ComputeVersion5xPinnedRpcTests, self).setUp()
26+
self.useFixture(cast_as_call.CastAsCall(self))
27+
28+
self.compute1 = self._start_compute(host='host1')
29+
30+
def _test_rebuild_instance_with_compute_rpc_pin(self, version_cap):
31+
self.flags(compute=version_cap, group='upgrade_levels')
32+
33+
server_req = self._build_server(networks='none')
34+
server = self.api.post_server({'server': server_req})
35+
server = self._wait_for_state_change(server, 'ACTIVE')
36+
37+
self.api.post_server_action(server['id'], {'rebuild': {
38+
'imageRef': '155d900f-4e14-4e4c-a73d-069cbf4541e6'
39+
}})
40+
41+
def test_rebuild_instance_5_0(self):
42+
e = self.assertRaises(client.OpenStackApiException,
43+
self._test_rebuild_instance_with_compute_rpc_pin, '5.0')
44+
self.assertEqual(500, e.response.status_code)
45+
# NOTE(sbauza): It provides a TypeError because of 'accel_uuids'
46+
# parameter missing
47+
# TypeError: rebuild_instance() missing 1 required positional argument:
48+
# 'accel_uuids'
49+
self.assertIn('TypeError', e.response.text)
50+
51+
def test_rebuild_instance_5_12(self):
52+
self._test_rebuild_instance_with_compute_rpc_pin('5.12')

0 commit comments

Comments
 (0)