Browse Source

Add failover tests

Add power off/shutdown tests for murano and controller
nodes.

Change-Id: I20bb076bbbe7dac30bce751b576d12b513b99bf0
Rodion Promyshlennikov 2 years ago
parent
commit
da29a248be

+ 34
- 0
murano_plugin_tests/murano_plugin/api.py View File

@@ -12,6 +12,10 @@
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14 14
 
15
+import functools
16
+
17
+from devops.helpers import helpers as devops_helpers
18
+from fuelweb_test import logger
15 19
 from fuelweb_test.tests import base_test_case
16 20
 
17 21
 from murano_plugin_tests.helpers import checkers
@@ -101,3 +105,33 @@ class MuranoPluginApi(object):
101 105
     def check_uninstall_failure(self):
102 106
         return self.helpers.check_plugin_cannot_be_uninstalled(
103 107
             self.settings.name, self.settings.version)
108
+
109
+    def wait_plugin_online(self, timeout=5 * 60):
110
+        """Wait until the plugin will start working properly.
111
+        """
112
+
113
+        def check_availability():
114
+            try:
115
+                self.check_plugin_online()
116
+                return True
117
+            except AssertionError:
118
+                return False
119
+
120
+        logger.info('Wait a plugin become online')
121
+        msg = "Plugin has not become online after a waiting period"
122
+        devops_helpers.wait(
123
+            check_availability, interval=30, timeout=timeout, timeout_msg=msg)
124
+
125
+    def check_plugin_failover(self, operation, role_name):
126
+        fuel_web_client = self.helpers.fuel_web
127
+        operations = {
128
+            "soft_reboot": fuel_web_client.warm_restart_nodes,
129
+            "hard_reboot": functools.partial(
130
+                fuel_web_client.cold_restart_nodes, wait_offline=False)
131
+        }
132
+        nailgun_nodes = fuel_web_client.get_nailgun_cluster_nodes_by_roles(
133
+            self.helpers.cluster_id, role_name)
134
+        target_node = fuel_web_client.get_devops_nodes_by_nailgun_nodes(
135
+            nailgun_nodes[:1])
136
+        operations[operation](target_node)
137
+        self.wait_plugin_online()

+ 100
- 0
murano_plugin_tests/murano_plugin/test_failover.py View File

@@ -0,0 +1,100 @@
1
+#    Copyright 2016 Mirantis, Inc.
2
+#
3
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+#    not use this file except in compliance with the License. You may obtain
5
+#    a copy of the License at
6
+#
7
+#         http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+#    Unless required by applicable law or agreed to in writing, software
10
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+#    License for the specific language governing permissions and limitations
13
+#    under the License.
14
+
15
+from fuelweb_test.helpers.decorators import log_snapshot_after_test
16
+from proboscis import test
17
+
18
+from murano_plugin_tests.murano_plugin import api
19
+
20
+
21
+@test(groups=["plugin"])
22
+class TestMuranoFailover(api.MuranoPluginApi):
23
+    """Class for testing that the Murano Detach plugin works properly
24
+    on controller or detached node fail.
25
+    """
26
+
27
+    def _test_failover(self, operation, role_name):
28
+        self.env.revert_snapshot("deploy_murano_plugin")
29
+
30
+        self.check_plugin_failover(operation, role_name)
31
+
32
+        self.run_ostf()
33
+
34
+    @test(depends_on_groups=["deploy_murano_plugin"],
35
+          groups=["failover", "murano", "system", "destructive",
36
+                  "soft_reboot_murano_node"])
37
+    @log_snapshot_after_test
38
+    def soft_reboot_murano_node(self):
39
+        """Verify that failover for Murano plugin works
40
+        on Murano detached node soft_reboot.
41
+
42
+        Scenario:
43
+            1. Soft reboot murano node.
44
+            2. Check that plugin is working.
45
+            3. Run OSTF.
46
+
47
+        Duration 30m
48
+        """
49
+        self._test_failover("soft_reboot", self.settings.role_name)
50
+
51
+    @test(depends_on_groups=["deploy_murano_plugin"],
52
+          groups=["failover", "murano", "system", "destructive",
53
+                  "hard_reboot_murano_node"])
54
+    @log_snapshot_after_test
55
+    def hard_reboot_murano_node(self):
56
+        """Verify that failover for Murano plugin works
57
+        on Murano detached node power off.
58
+
59
+        Scenario:
60
+            1. Hard reboot murano node.
61
+            2. Check that plugin is working.
62
+            3. Run OSTF.
63
+
64
+        Duration 30m
65
+        """
66
+        self._test_failover("hard_reboot", self.settings.role_name)
67
+
68
+    @test(depends_on_groups=["deploy_murano_plugin"],
69
+          groups=["failover", "murano", "system", "destructive",
70
+                  "soft_reboot_controller_node_murano_plugin"])
71
+    @log_snapshot_after_test
72
+    def soft_reboot_controller_node_murano_plugin(self):
73
+        """Verify that failover for Murano plugin works
74
+        on controller node soft_reboot.
75
+
76
+        Scenario:
77
+            1. Soft reboot controller node.
78
+            2. Check that plugin is working.
79
+            3. Run OSTF.
80
+
81
+        Duration 30m
82
+        """
83
+        self._test_failover("soft_reboot", ["controller"])
84
+
85
+    @test(depends_on_groups=["deploy_murano_plugin"],
86
+          groups=["failover", "murano", "system", "destructive",
87
+                  "hard_reboot_controller_node_murano_plugin"])
88
+    @log_snapshot_after_test
89
+    def hard_reboot_controller_node_murano_plugin(self):
90
+        """Verify that failover for Murano plugin works
91
+        on controller node power off.
92
+
93
+        Scenario:
94
+            1. Hard reboot controller node.
95
+            2. Check that plugin is working.
96
+            3. Run OSTF.
97
+
98
+        Duration 30m
99
+        """
100
+        self._test_failover("hard_reboot", ["controller"])

+ 1
- 0
murano_plugin_tests/run_tests.py View File

@@ -39,6 +39,7 @@ class CloseSSHConnectionsPlugin(plugins.Plugin):
39 39
 
40 40
 
41 41
 def import_tests():
42
+    from murano_plugin import test_failover  # noqa
42 43
     from murano_plugin import test_murano_plugin_bvt  # noqa
43 44
     from murano_plugin import test_post_install  # noqa
44 45
     from murano_plugin import test_system  # noqa

Loading…
Cancel
Save