summaryrefslogtreecommitdiff
path: root/trove/tests/scenario/groups/cluster_group.py
blob: cadd8565b2f317d418dc282cb746d9bc293fcbd5 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# 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.cluster_group"


class ClusterRunnerFactory(test_runners.RunnerFactory):

    _runner_ns = 'cluster_runners'
    _runner_cls = 'ClusterRunner'


@test(groups=[GROUP, groups.CLUSTER_CREATE],
      runs_after_groups=[groups.MODULE_DELETE,
                         groups.CFGGRP_INST_DELETE,
                         groups.INST_ACTIONS_RESIZE_WAIT,
                         groups.DB_ACTION_INST_DELETE,
                         groups.USER_ACTION_DELETE,
                         groups.USER_ACTION_INST_DELETE,
                         groups.ROOT_ACTION_INST_DELETE,
                         groups.REPL_INST_DELETE_WAIT,
                         groups.INST_DELETE])
class ClusterCreateGroup(TestGroup):

    def __init__(self):
        super(ClusterCreateGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_create(self):
        """Create a cluster."""
        self.test_runner.run_cluster_create()


@test(groups=[GROUP, groups.CLUSTER_CREATE_WAIT],
      depends_on_groups=[groups.CLUSTER_CREATE],
      runs_after_groups=[groups.MODULE_INST_DELETE_WAIT,
                         groups.CFGGRP_INST_DELETE_WAIT,
                         groups.DB_ACTION_INST_DELETE_WAIT,
                         groups.USER_ACTION_INST_DELETE_WAIT,
                         groups.ROOT_ACTION_INST_DELETE_WAIT,
                         groups.INST_DELETE_WAIT])
class ClusterCreateWaitGroup(TestGroup):

    def __init__(self):
        super(ClusterCreateWaitGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_create_wait(self):
        """Wait for cluster create to complete."""
        self.test_runner.run_cluster_create_wait()

    @test(depends_on=[cluster_create_wait])
    def add_initial_cluster_data(self):
        """Add data to cluster."""
        self.test_runner.run_add_initial_cluster_data()

    @test(depends_on=[add_initial_cluster_data])
    def verify_initial_cluster_data(self):
        """Verify the initial data exists on cluster."""
        self.test_runner.run_verify_initial_cluster_data()

    @test(depends_on=[cluster_create_wait])
    def cluster_list(self):
        """List the clusters."""
        self.test_runner.run_cluster_list()

    @test(depends_on=[cluster_create_wait])
    def cluster_show(self):
        """Show a cluster."""
        self.test_runner.run_cluster_show()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_ACTIONS_ROOT_ENABLE],
      depends_on_groups=[groups.CLUSTER_CREATE_WAIT])
class ClusterRootEnableGroup(TestGroup):

    def __init__(self):
        super(ClusterRootEnableGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_root_enable(self):
        """Root Enable."""
        self.test_runner.run_cluster_root_enable()

    @test(depends_on=[cluster_root_enable])
    def verify_cluster_root_enable(self):
        """Verify Root Enable."""
        self.test_runner.run_verify_cluster_root_enable()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_ACTIONS_GROW_SHRINK,
              groups.CLUSTER_ACTIONS_GROW],
      depends_on_groups=[groups.CLUSTER_CREATE_WAIT],
      runs_after_groups=[groups.CLUSTER_ACTIONS_ROOT_ENABLE])
class ClusterGrowGroup(TestGroup):

    def __init__(self):
        super(ClusterGrowGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_grow(self):
        """Grow cluster."""
        self.test_runner.run_cluster_grow()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_ACTIONS_GROW_SHRINK,
              groups.CLUSTER_ACTIONS_GROW_WAIT],
      depends_on_groups=[groups.CLUSTER_ACTIONS_GROW])
class ClusterGrowWaitGroup(TestGroup):
    def __init__(self):
        super(ClusterGrowWaitGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_grow_wait(self):
        """Wait for cluster grow to complete."""
        self.test_runner.run_cluster_grow_wait()

    @test(depends_on=[cluster_grow_wait])
    def verify_initial_cluster_data_after_grow(self):
        """Verify the initial data still exists after cluster grow."""
        self.test_runner.run_verify_initial_cluster_data()

    @test(depends_on=[cluster_grow_wait],
          runs_after=[verify_initial_cluster_data_after_grow])
    def add_grow_cluster_data(self):
        """Add more data to cluster after grow."""
        self.test_runner.run_add_grow_cluster_data()

    @test(depends_on=[add_grow_cluster_data])
    def verify_grow_cluster_data(self):
        """Verify the data added after cluster grow."""
        self.test_runner.run_verify_grow_cluster_data()

    @test(depends_on=[add_grow_cluster_data],
          runs_after=[verify_grow_cluster_data])
    def remove_grow_cluster_data(self):
        """Remove the data added after cluster grow."""
        self.test_runner.run_remove_grow_cluster_data()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_ACTIONS_ROOT_ACTIONS,
              groups.CLUSTER_ACTIONS_ROOT_GROW],
      depends_on_groups=[groups.CLUSTER_ACTIONS_GROW_WAIT])
class ClusterRootEnableGrowGroup(TestGroup):

    def __init__(self):
        super(ClusterRootEnableGrowGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def verify_cluster_root_enable_after_grow(self):
        """Verify Root Enabled after grow."""
        self.test_runner.run_verify_cluster_root_enable()


@test(groups=[GROUP, groups.CLUSTER_UPGRADE],
      depends_on_groups=[groups.CLUSTER_CREATE_WAIT],
      runs_after_groups=[groups.CLUSTER_ACTIONS_GROW_WAIT,
                         groups.CLUSTER_ACTIONS_ROOT_GROW])
class ClusterUpgradeGroup(TestGroup):

    def __init__(self):
        super(ClusterUpgradeGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_upgrade(self):
        """Upgrade cluster."""
        self.test_runner.run_cluster_upgrade()


@test(groups=[GROUP, groups.CLUSTER_UPGRADE_WAIT],
      depends_on_groups=[groups.CLUSTER_UPGRADE])
class ClusterUpgradeWaitGroup(TestGroup):
    def __init__(self):
        super(ClusterUpgradeWaitGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_upgrade_wait(self):
        """Wait for cluster upgrade to complete."""
        self.test_runner.run_cluster_upgrade_wait()

    @test(depends_on=[cluster_upgrade_wait])
    def verify_initial_cluster_data_after_upgrade(self):
        """Verify the initial data still exists after cluster upgrade."""
        self.test_runner.run_verify_initial_cluster_data()

    @test(depends_on=[cluster_upgrade_wait],
          runs_after=[verify_initial_cluster_data_after_upgrade])
    def add_upgrade_cluster_data_after_upgrade(self):
        """Add more data to cluster after upgrade."""
        self.test_runner.run_add_upgrade_cluster_data()

    @test(depends_on=[add_upgrade_cluster_data_after_upgrade])
    def verify_upgrade_cluster_data_after_upgrade(self):
        """Verify the data added after cluster upgrade."""
        self.test_runner.run_verify_upgrade_cluster_data()

    @test(depends_on=[add_upgrade_cluster_data_after_upgrade],
          runs_after=[verify_upgrade_cluster_data_after_upgrade])
    def remove_upgrade_cluster_data_after_upgrade(self):
        """Remove the data added after cluster upgrade."""
        self.test_runner.run_remove_upgrade_cluster_data()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_ACTIONS_GROW_SHRINK,
              groups.CLUSTER_ACTIONS_SHRINK],
      depends_on_groups=[groups.CLUSTER_ACTIONS_GROW_WAIT],
      runs_after_groups=[groups.CLUSTER_UPGRADE_WAIT])
class ClusterShrinkGroup(TestGroup):

    def __init__(self):
        super(ClusterShrinkGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_shrink(self):
        """Shrink cluster."""
        self.test_runner.run_cluster_shrink()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_ACTIONS_SHRINK_WAIT],
      depends_on_groups=[groups.CLUSTER_ACTIONS_SHRINK])
class ClusterShrinkWaitGroup(TestGroup):
    def __init__(self):
        super(ClusterShrinkWaitGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_shrink_wait(self):
        """Wait for the cluster shrink to complete."""
        self.test_runner.run_cluster_shrink_wait()

    @test(depends_on=[cluster_shrink_wait])
    def verify_initial_cluster_data_after_shrink(self):
        """Verify the initial data still exists after cluster shrink."""
        self.test_runner.run_verify_initial_cluster_data()

    @test(runs_after=[verify_initial_cluster_data_after_shrink])
    def add_shrink_cluster_data(self):
        """Add more data to cluster after shrink."""
        self.test_runner.run_add_shrink_cluster_data()

    @test(depends_on=[add_shrink_cluster_data])
    def verify_shrink_cluster_data(self):
        """Verify the data added after cluster shrink."""
        self.test_runner.run_verify_shrink_cluster_data()

    @test(depends_on=[add_shrink_cluster_data],
          runs_after=[verify_shrink_cluster_data])
    def remove_shrink_cluster_data(self):
        """Remove the data added after cluster shrink."""
        self.test_runner.run_remove_shrink_cluster_data()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_ACTIONS_ROOT_ACTIONS,
              groups.CLUSTER_ACTIONS_ROOT_SHRINK],
      depends_on_groups=[groups.CLUSTER_ACTIONS_SHRINK_WAIT])
class ClusterRootEnableShrinkGroup(TestGroup):

    def __init__(self):
        super(ClusterRootEnableShrinkGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def verify_cluster_root_enable_after_shrink(self):
        """Verify Root Enable after shrink."""
        self.test_runner.run_verify_cluster_root_enable()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_DELETE],
      depends_on_groups=[groups.CLUSTER_CREATE_WAIT],
      runs_after_groups=[groups.CLUSTER_ACTIONS_ROOT_ENABLE,
                         groups.CLUSTER_ACTIONS_ROOT_GROW,
                         groups.CLUSTER_ACTIONS_ROOT_SHRINK,
                         groups.CLUSTER_ACTIONS_GROW_WAIT,
                         groups.CLUSTER_ACTIONS_SHRINK_WAIT,
                         groups.CLUSTER_UPGRADE_WAIT])
class ClusterDeleteGroup(TestGroup):

    def __init__(self):
        super(ClusterDeleteGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def remove_initial_cluster_data(self):
        """Remove the initial data from cluster."""
        self.test_runner.run_remove_initial_cluster_data()

    @test(runs_after=[remove_initial_cluster_data])
    def cluster_delete(self):
        """Delete an existing cluster."""
        self.test_runner.run_cluster_delete()


@test(groups=[GROUP, groups.CLUSTER_ACTIONS,
              groups.CLUSTER_DELETE_WAIT],
      depends_on_groups=[groups.CLUSTER_DELETE])
class ClusterDeleteWaitGroup(TestGroup):

    def __init__(self):
        super(ClusterDeleteWaitGroup, self).__init__(
            ClusterRunnerFactory.instance())

    @test
    def cluster_delete_wait(self):
        """Wait for the existing cluster to be gone."""
        self.test_runner.run_cluster_delete_wait()