summaryrefslogtreecommitdiff
path: root/tempest/api/compute/servers/test_multiple_create_negative.py
blob: 3a970dd05851f05a72b5627ea1f9f77beecd2148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2013 IBM Corp
# 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 tempest.api.compute import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc


class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
    """Negative tests of creating multiple servers in one request"""

    @decorators.attr(type=['negative'])
    @decorators.idempotent_id('daf29d8d-e928-4a01-9a8c-b129603f3fc0')
    def test_min_count_less_than_one(self):
        """Test creating server with min_count=0 should fail"""
        invalid_min_count = 0
        self.assertRaises(lib_exc.BadRequest, self.create_test_server,
                          min_count=invalid_min_count)

    @decorators.attr(type=['negative'])
    @decorators.idempotent_id('999aa722-d624-4423-b813-0d1ac9884d7a')
    def test_min_count_non_integer(self):
        """Test creating server with non-integer min_count should fail"""
        invalid_min_count = 2.5
        self.assertRaises(lib_exc.BadRequest, self.create_test_server,
                          min_count=invalid_min_count)

    @decorators.attr(type=['negative'])
    @decorators.idempotent_id('a6f9c2ab-e060-4b82-b23c-4532cb9390ff')
    def test_max_count_less_than_one(self):
        """Test creating server with max_count < 1 shoudld fail"""
        invalid_max_count = 0
        self.assertRaises(lib_exc.BadRequest, self.create_test_server,
                          max_count=invalid_max_count)

    @decorators.attr(type=['negative'])
    @decorators.idempotent_id('9c5698d1-d7af-4c80-b971-9d403135eea2')
    def test_max_count_non_integer(self):
        """Test creating server with non-integer max_count should fail"""
        invalid_max_count = 2.5
        self.assertRaises(lib_exc.BadRequest, self.create_test_server,
                          max_count=invalid_max_count)

    @decorators.attr(type=['negative'])
    @decorators.idempotent_id('476da616-f1ef-4271-a9b1-b9fc87727cdf')
    def test_max_count_less_than_min_count(self):
        """Test creating server with max_count < min_count should fail"""
        min_count = 3
        max_count = 2
        self.assertRaises(lib_exc.BadRequest, self.create_test_server,
                          min_count=min_count,
                          max_count=max_count)