Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 1 | # Copyright 2013 IBM Corp |
| 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
Sean Dague | 1937d09 | 2013-05-17 16:36:38 -0400 | [diff] [blame] | 16 | from tempest.api.compute import base |
Fei Long Wang | d39431f | 2015-05-14 11:30:48 +1200 | [diff] [blame] | 17 | from tempest.common.utils import data_utils |
Hoisaleshwara Madan V S | 65e5303 | 2013-12-26 12:55:44 +0530 | [diff] [blame] | 18 | from tempest import test |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 19 | |
| 20 | |
ivan-zhu | f2b0050 | 2013-10-18 10:06:52 +0800 | [diff] [blame] | 21 | class MultipleCreateTestJSON(base.BaseV2ComputeTest): |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 22 | _name = 'multiple-create-test' |
| 23 | |
Tianbiao Qi | 67ba5e9 | 2016-09-27 11:33:30 +0800 | [diff] [blame] | 24 | def _create_multiple_servers(self, **kwargs): |
| 25 | # This is the right way to create_multiple servers and manage to get |
| 26 | # the created servers into the servers list to be cleaned up after all. |
| 27 | kwargs['name'] = kwargs.get('name', data_utils.rand_name(self._name)) |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 28 | body = self.create_test_server(**kwargs) |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 29 | |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 30 | return body |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 31 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 32 | @test.idempotent_id('61e03386-89c3-449c-9bb1-a06f423fd9d1') |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 33 | def test_multiple_create(self): |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 34 | body = self._create_multiple_servers(wait_until='ACTIVE', |
| 35 | min_count=1, |
| 36 | max_count=2) |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 37 | # NOTE(maurosr): do status response check and also make sure that |
| 38 | # reservation_id is not in the response body when the request send |
| 39 | # contains return_reservation_id=False |
Attila Fazekas | e191cb1 | 2013-07-29 06:41:52 +0200 | [diff] [blame] | 40 | self.assertNotIn('reservation_id', body) |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 41 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 42 | @test.idempotent_id('864777fb-2f1e-44e3-b5b9-3eb6fa84f2f7') |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 43 | def test_multiple_create_with_reservation_return(self): |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 44 | body = self._create_multiple_servers(wait_until='ACTIVE', |
| 45 | min_count=1, |
| 46 | max_count=2, |
| 47 | return_reservation_id=True) |
Mauro S. M. Rodrigues | c5da4f4 | 2013-03-04 23:57:10 -0500 | [diff] [blame] | 48 | self.assertIn('reservation_id', body) |