summaryrefslogtreecommitdiff
path: root/trove/tests/scenario/groups/instance_actions_group.py
blob: 3730c24a132792437ed79a29af576ef8e4375419 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright 2015 Tesora Inc.
# 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 proboscis import test

from trove.tests.scenario import groups
from trove.tests.scenario.groups.test_group import TestGroup
from trove.tests.scenario.runners import test_runners


GROUP = "scenario.instance_actions_group"


class InstanceActionsRunnerFactory(test_runners.RunnerFactory):

    _runner_ns = 'instance_actions_runners'
    _runner_cls = 'InstanceActionsRunner'


@test(depends_on_groups=[groups.INST_CREATE_WAIT],
      groups=[GROUP, groups.INST_ACTIONS],
      runs_after_groups=[groups.MODULE_INST_CREATE,
                         groups.CFGGRP_INST_CREATE])
class InstanceActionsGroup(TestGroup):
    """Test Instance Actions functionality."""

    def __init__(self):
        super(InstanceActionsGroup, self).__init__(
            InstanceActionsRunnerFactory.instance())

    @test
    def instance_restart(self):
        """Restart an existing instance."""
        self.test_runner.run_instance_restart()

    @test(depends_on=[instance_restart])
    def instance_resize_volume(self):
        """Resize attached volume."""
        self.test_runner.run_instance_resize_volume()


@test(depends_on_groups=[groups.INST_CREATE_WAIT],
      groups=[GROUP, groups.INST_ACTIONS_RESIZE],
      runs_after_groups=[groups.INST_ACTIONS,
                         groups.INST_UPGRADE,
                         groups.MODULE_INST_CREATE_WAIT,
                         groups.CFGGRP_INST_CREATE_WAIT,
                         groups.BACKUP_CREATE,
                         groups.BACKUP_INC_CREATE])
class InstanceActionsResizeGroup(TestGroup):
    """Test Instance Actions Resize functionality."""

    def __init__(self):
        super(InstanceActionsResizeGroup, self).__init__(
            InstanceActionsRunnerFactory.instance())

    @test
    def instance_resize_flavor(self):
        """Resize instance flavor."""
        self.test_runner.run_instance_resize_flavor()


@test(depends_on_groups=[groups.INST_ACTIONS_RESIZE],
      groups=[GROUP, groups.INST_ACTIONS_RESIZE_WAIT],
      runs_after_groups=[groups.BACKUP_INST_CREATE,
                         groups.BACKUP_INC_INST_CREATE,
                         groups.DB_ACTION_INST_CREATE])
class InstanceActionsResizeWaitGroup(TestGroup):
    """Test that Instance Actions Resize Completes."""

    def __init__(self):
        super(InstanceActionsResizeWaitGroup, self).__init__(
            InstanceActionsRunnerFactory.instance())

    @test
    def wait_for_instance_resize_flavor(self):
        """Wait for resize instance flavor to complete."""
        self.test_runner.run_wait_for_instance_resize_flavor()