Browse Source

Improvment for scale test

The same cluster used for two tests. We should make snapshot
after cluster deployment and use it for both tests.

Change-Id: I3f404d8270782456bb977a8a35bf4c2d0288bf23
(cherry picked from commit ed4ebfee1a)
Dmitry Belyaninov 2 years ago
parent
commit
b38cd9fe1a
1 changed files with 49 additions and 37 deletions
  1. 49
    37
      fuelweb_test/tests/tests_scale/test_scale_group_2.py

+ 49
- 37
fuelweb_test/tests/tests_scale/test_scale_group_2.py View File

@@ -27,25 +27,18 @@ class HaScaleGroup2(TestBasic):
27 27
     """HaScaleGroup2."""  # TODO documentation
28 28
 
29 29
     @test(depends_on=[SetupEnvironment.prepare_slaves_5],
30
-          groups=["replace_primary_controller"])
30
+          groups=["ha_scale_group_2_cluster"])
31 31
     @log_snapshot_after_test
32
-    def replace_primary_controller(self):
33
-        """Replace the primary controller in the cluster
32
+    def ha_scale_group_2_cluster(self):
33
+        """Deploy cluster with 3 controllers and 1 compute
34 34
 
35 35
         Scenario:
36 36
             1. Create cluster
37 37
             2. Add 3 controller nodes and 1 compute
38 38
             3. Deploy the cluster
39
-            4. Destroy primary controller
40
-            5. Wait controller offline
41
-            6. Remove offline controller from cluster
42
-            7. Add 1 new controller
43
-            8. Deploy changes
44
-            9. Run OSTF
45
-            10. Verify networks
46 39
 
47
-        Duration 120m
48
-        Snapshot replace_primary_controller
40
+        Duration 80m
41
+        Snapshot ha_scale_group_2_cluster
49 42
 
50 43
         """
51 44
         self.env.revert_snapshot("ready_with_5_slaves")
@@ -65,6 +58,37 @@ class HaScaleGroup2(TestBasic):
65 58
         )
66 59
         self.show_step(3)
67 60
         self.fuel_web.deploy_cluster_wait(cluster_id)
61
+        self.fuel_web.verify_network(cluster_id)
62
+        self.env.make_snapshot("ha_scale_group_2_cluster",
63
+                               is_make=True)
64
+
65
+    @test(depends_on=[ha_scale_group_2_cluster],
66
+          groups=["replace_primary_controller"])
67
+    @log_snapshot_after_test
68
+    def replace_primary_controller(self):
69
+        """Replace the primary controller in the cluster
70
+
71
+        Scenario:
72
+            1. Create cluster
73
+            2. Add 3 controller nodes and 1 compute
74
+            3. Deploy the cluster
75
+            4. Destroy primary controller
76
+            5. Wait controller offline
77
+            6. Remove offline controller from cluster
78
+            7. Add 1 new controller
79
+            8. Deploy changes
80
+            9. Run OSTF
81
+            10. Verify networks
82
+
83
+        Duration 120m
84
+        Snapshot replace_primary_controller
85
+
86
+        """
87
+        self.env.revert_snapshot("ha_scale_group_2_cluster")
88
+        self.show_step(1, initialize=True)
89
+        self.show_step(2)
90
+        self.show_step(3)
91
+        cluster_id = self.fuel_web.get_last_created_cluster()
68 92
 
69 93
         self.show_step(4)
70 94
         primary_controller = self.fuel_web.get_nailgun_primary_node(
@@ -86,13 +110,13 @@ class HaScaleGroup2(TestBasic):
86 110
         )
87 111
         self.show_step(8)
88 112
         self.fuel_web.deploy_cluster_wait(cluster_id)
89
-        self.show_step(10)
90
-        self.fuel_web.verify_network(cluster_id)
91 113
         self.show_step(9)
92 114
         self.fuel_web.run_ostf(cluster_id=cluster_id)
115
+        self.show_step(10)
116
+        self.fuel_web.verify_network(cluster_id)
93 117
         self.env.make_snapshot("replace_primary_controller")
94 118
 
95
-    @test(depends_on=[SetupEnvironment.prepare_slaves_5],
119
+    @test(depends_on=[ha_scale_group_2_cluster],
96 120
           groups=["remove_controllers"])
97 121
     @log_snapshot_after_test
98 122
     def remove_controllers(self):
@@ -114,31 +138,19 @@ class HaScaleGroup2(TestBasic):
114 138
         Snapshot remove_controllers
115 139
 
116 140
         """
117
-        self.env.revert_snapshot("ready_with_5_slaves")
141
+        self.env.revert_snapshot("ha_scale_group_2_cluster")
118 142
         self.show_step(1, initialize=True)
119
-        cluster_id = self.fuel_web.create_cluster(
120
-            name=self.__class__.__name__,
121
-            mode=DEPLOYMENT_MODE)
122 143
         self.show_step(2)
123
-        self.fuel_web.update_nodes(
124
-            cluster_id,
125
-            {
126
-                'slave-01': ['controller'],
127
-                'slave-02': ['controller'],
128
-                'slave-03': ['controller'],
129
-                'slave-04': ['compute']
130
-            }
131
-        )
132 144
         self.show_step(3)
133
-        self.fuel_web.deploy_cluster_wait(cluster_id)
145
+        cluster_id = self.fuel_web.get_last_created_cluster()
134 146
 
135 147
         hosts = []
136 148
 
137 149
         for node_name in ('slave-02', 'slave-03'):
138 150
             node = self.fuel_web.get_nailgun_node_by_devops_node(
139 151
                 self.env.d_env.get_node(name=node_name))
140
-            hostname = ''.join(self.ssh_manager.execute_on_remote(
141
-                ip=node['ip'], cmd="hostname")['stdout']).strip()
152
+            hostname = ''.join(self.ssh_manager.check_call(
153
+                ip=node['ip'], command="hostname")['stdout']).strip()
142 154
             hosts.append(hostname)
143 155
         logger.debug('hostname are {}'.format(hosts))
144 156
         nodes = {'slave-02': ['controller'],
@@ -150,10 +162,10 @@ class HaScaleGroup2(TestBasic):
150 162
         )
151 163
         self.show_step(5)
152 164
         self.fuel_web.deploy_cluster_wait(cluster_id)
153
-        self.show_step(7)
154
-        self.fuel_web.verify_network(cluster_id)
155 165
         self.show_step(6)
156 166
         self.fuel_web.run_ostf(cluster_id=cluster_id)
167
+        self.show_step(7)
168
+        self.fuel_web.verify_network(cluster_id)
157 169
 
158 170
         node = self.fuel_web.get_nailgun_node_by_devops_node(
159 171
             self.env.d_env.get_node(name='slave-01'))
@@ -162,15 +174,15 @@ class HaScaleGroup2(TestBasic):
162 174
             self.show_step(8, initialize=True)
163 175
             cmd = "grep '{}' /etc/hosts".format(host)
164 176
             logger.info('Checking hosts on {}'.format(host))
165
-            result = self.ssh_manager.execute_on_remote(
166
-                ip=node['ip'], cmd=cmd, assert_ec_equal=[1])
177
+            result = self.ssh_manager.check_call(
178
+                ip=node['ip'], command=cmd, expected=[1])
167 179
             assert_equal(result['exit_code'], 1,
168 180
                          "host {} is present in /etc/hosts".format(host))
169 181
             self.show_step(9)
170 182
             cmd = "grep '{}' /etc/corosync/corosync.conf".format(host)
171 183
             logger.info('Checking corosync.conf on {}'.format(host))
172
-            result = self.ssh_manager.execute_on_remote(
173
-                ip=node['ip'], cmd=cmd, assert_ec_equal=[1])
184
+            result = self.ssh_manager.check_call(
185
+                ip=node['ip'], command=cmd, expected=[1])
174 186
             assert_equal(result['exit_code'], 1,
175 187
                          "host {} is present in"
176 188
                          " /etc/corosync/corosync.conf".format(host))

Loading…
Cancel
Save