Statistics
| Branch: | Tag: | Revision:

root / snf-tools / synnefo_tools / burnin / cyclades_tests.py @ d11c80c0

History | View | Annotate | Download (3.4 kB)

1
# Copyright 2013 GRNET S.A. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
#
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
#
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
#
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.
33

    
34
"""
35
This is the burnin class that tests the Cyclades functionality
36

37
"""
38

    
39
from synnefo_tools.burnin.common import BurninTests, Proper
40

    
41

    
42
# Too many public methods. pylint: disable-msg=R0904
43
class FlavorsTestSuite(BurninTests):
44
    """Test flavor lists for consistency"""
45
    simple_flavors = Proper(value=None)
46
    detailed_flavors = Proper(value=None)
47
    simple_names = Proper(value=None)
48

    
49
    def test_001_simple_flavors(self):
50
        """Test flavor list actually returns flavors"""
51
        self.simple_flavors = self._get_list_of_flavors(detail=False)
52
        self.assertGreater(len(self.simple_flavors), 0)
53

    
54
    def test_002_get_detailed_flavors(self):
55
        """Test detailed flavor list is the same length as list"""
56
        self.detailed_flavors = self._get_list_of_flavors(detail=True)
57
        self.assertEquals(len(self.simple_flavors), len(self.detailed_flavors))
58

    
59
    def test_003_same_flavor_names(self):
60
        """Test detailed and simple flavor list contain same names"""
61
        names = sorted([flv['name'] for flv in self.simple_flavors])
62
        self.simple_names = names
63
        detailed_names = sorted([flv['name'] for flv in self.detailed_flavors])
64
        self.assertEqual(self.simple_names, detailed_names)
65

    
66
    def test_004_unique_flavor_names(self):
67
        """Test flavors have unique names"""
68
        self.assertEqual(sorted(list(set(self.simple_names))),
69
                         self.simple_names)
70

    
71
    def test_005_well_formed_names(self):
72
        """Test flavors have well formed names
73

74
        Test flavors have names of the form CxxRyyDzz, where xx is vCPU count,
75
        yy is RAM in MiB, zz is Disk in GiB
76

77
        """
78
        for flv in self.detailed_flavors:
79
            flavor = (flv['vcpus'], flv['ram'], flv['disk'],
80
                      flv['SNF:disk_template'])
81
            self.assertEqual("C%dR%dD%d%s" % flavor, flv['name'],
82
                             "Flavor %s doesn't match its specs" % flv['name'])