Statistics
| Branch: | Tag: | Revision:

root / snf-tools / synnefo_tools / burnin / projects_tests.py @ c2f037ff

History | View | Annotate | Download (2.8 kB)

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

37 a6e5a05f Ilias Tsitsimpis
"""
38 a6e5a05f Ilias Tsitsimpis
39 c2f037ff Ilias Tsitsimpis
import random
40 c2f037ff Ilias Tsitsimpis
41 c2f037ff Ilias Tsitsimpis
from synnefo_tools.burnin.common import Proper
42 c2f037ff Ilias Tsitsimpis
from synnefo_tools.burnin.cyclades_common import CycladesTests
43 a6e5a05f Ilias Tsitsimpis
44 a6e5a05f Ilias Tsitsimpis
45 a6e5a05f Ilias Tsitsimpis
# pylint: disable=too-many-public-methods
46 c2f037ff Ilias Tsitsimpis
class QuotasTestSuite(CycladesTests):
47 a6e5a05f Ilias Tsitsimpis
    """Test Quotas functionality"""
48 c2f037ff Ilias Tsitsimpis
    server = Proper(value=None)
49 a6e5a05f Ilias Tsitsimpis
50 a6e5a05f Ilias Tsitsimpis
    def test_001_check_skip(self):
51 a6e5a05f Ilias Tsitsimpis
        """Check if we are members in more than one projects"""
52 a6e5a05f Ilias Tsitsimpis
        self._skip_suite_if(len(self.quotas.keys()) < 2,
53 a6e5a05f Ilias Tsitsimpis
                            "This user is not a member of 2 or more projects")
54 c2f037ff Ilias Tsitsimpis
55 c2f037ff Ilias Tsitsimpis
    def test_002_create(self):
56 c2f037ff Ilias Tsitsimpis
        """Create a machine to a different project than base"""
57 c2f037ff Ilias Tsitsimpis
        image = random.choice(self._parse_images())
58 c2f037ff Ilias Tsitsimpis
        flavors = self._parse_flavors()
59 c2f037ff Ilias Tsitsimpis
60 c2f037ff Ilias Tsitsimpis
        # We want to create our machine in a project other than 'base'
61 c2f037ff Ilias Tsitsimpis
        projects = self.quotas.keys()
62 c2f037ff Ilias Tsitsimpis
        projects.remove(self._get_uuid())
63 c2f037ff Ilias Tsitsimpis
        (flavor, project) = self._find_project(flavors, projects)
64 c2f037ff Ilias Tsitsimpis
65 c2f037ff Ilias Tsitsimpis
        # Create machine
66 c2f037ff Ilias Tsitsimpis
        self.server = self._create_server(image, flavor, network=True,
67 c2f037ff Ilias Tsitsimpis
                                          project_id=project)
68 c2f037ff Ilias Tsitsimpis
69 c2f037ff Ilias Tsitsimpis
        # Wait for server to become active
70 c2f037ff Ilias Tsitsimpis
        self._insist_on_server_transition(
71 c2f037ff Ilias Tsitsimpis
            self.server, ["BUILD"], "ACTIVE")