|
| 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