blob: 507843954bb2724f25832beaf537ac407b93f5a9 [file] [log] [blame]
Hanna Arhipova71ecc272019-08-20 14:54:22 +03001import pytest
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +03002import sys
3import os
Hanna Arhipova71ecc272019-08-20 14:54:22 +03004
5from tcp_tests import logger
6from tcp_tests import settings
Hanna Arhipova71ecc272019-08-20 14:54:22 +03007
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +03008sys.path.append(os.getcwd())
9try:
10 from tcp_tests.fixtures import config_fixtures
11 from tcp_tests.managers import underlay_ssh_manager
12 from tcp_tests.managers import saltmanager as salt_manager
13except ImportError:
14 print("ImportError: Run the application from the tcp-qa directory or "
15 "set the PYTHONPATH environment variable to directory which contains"
16 " ./tcp_tests")
17 sys.exit(1)
Hanna Arhipova71ecc272019-08-20 14:54:22 +030018LOG = logger.logger
19
20
Hanna Arhipovad35a29b2019-09-04 13:24:06 +030021def has_only_similar(values_by_nodes):
22 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030023 :param values_by_nodes: dict
Hanna Arhipovad35a29b2019-09-04 13:24:06 +030024 :return: bool, True if all items in the dict have similar values
25 """
26 values = list(values_by_nodes.values())
27 return all(value == values[0] for value in values)
28
29
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030030def get_control_plane_targets():
31 config = config_fixtures.config()
32 underlay = underlay_ssh_manager.UnderlaySSHManager(config)
33 saltmanager = salt_manager.SaltManager(config, underlay)
Hanna Arhipovafbcea852019-10-03 13:24:53 +030034 targets = list()
35 try:
36 targets += saltmanager.run_state(
37 "I@keystone:server", 'test.ping')[0]['return'][0].keys()
38 targets += saltmanager.run_state(
39 "I@nginx:server and not I@salt:master",
40 "test.ping")[0]['return'][0].keys()
41 except BaseException as err:
42 LOG.warning("Can't retrieve data from Salt. \
43 Maybe cluster is not deployed completely.\
44 Err: {}".format(err))
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030045
46 # TODO: add check for Manila existence
47 # # Commented to avoid fails during OpenStack updates.
48 # # Anyway we don't have deployments with Manila yet
49 # targets.append('share*')
50 # TODO: add check for Tenant Telemetry existence
51 targets.append('mdb*')
52 # TODO: add check for Barbican existence
53 targets.append('kmn*')
54 return targets
55
56
Hanna Arhipova19429962019-10-17 15:16:49 +030057@pytest.fixture(scope='class')
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030058def switch_to_proposed_pipelines(reclass_actions, salt_actions):
Hanna Arhipova19429962019-10-17 15:16:49 +030059 reclass = reclass_actions
60 proposed_repo = "http://mirror.mirantis.com/update/proposed/"
61 repo_param = "parameters._param.linux_system_repo_update_url"
Hanna Arhipova7cfeb072019-10-11 15:04:10 +030062
Hanna Arhipova19429962019-10-17 15:16:49 +030063 proposed_pipeline_branch = "release/proposed/2019.2.0"
64 pipeline_branch_param = "parameters._param.jenkins_pipelines_branch"
65 infra_yml = "cluster/*/infra/init.yml"
66
67 LOG.info("Check reclass has release/proposed/2019.2.0 branches")
68 if reclass.get_key(pipeline_branch_param,
69 infra_yml) == proposed_pipeline_branch \
70 and reclass.get_key(repo_param, infra_yml) == proposed_repo:
71 return True
72
73 LOG.info("Switch to release/proposed/2019.2.0 branches")
74 reclass.add_key(pipeline_branch_param, proposed_pipeline_branch, infra_yml)
75
76 reclass.add_key(repo_param, proposed_repo, infra_yml)
77 reclass.add_key(repo_param, proposed_repo, "cluster/*/openstack/init.yml")
78 reclass.add_key(repo_param, proposed_repo, "cluster/*/stacklight/init.yml")
79 reclass.add_key(repo_param, proposed_repo, "cluster/*/ceph/init.yml")
Hanna Arhipova7cfeb072019-10-11 15:04:10 +030080
81 salt_actions.run_state("*", "saltutil.refresh_pillar")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030082 salt_actions.enforce_state("I@jenkins:client", "jenkins.client")
83
84
Hanna Arhipova19429962019-10-17 15:16:49 +030085@pytest.fixture(scope='class')
86def enable_openstack_update(reclass_actions, salt_actions):
87 param = "parameters._param.openstack_upgrade_enabled"
88 context_file = "cluster/*/infra/init.yml"
89
90 LOG.info("Enable openstack_upgrade_enabled in reclass")
91 reclass_actions.add_bool_key(param, "True", context_file)
92 salt_actions.run_state("*", "saltutil.refresh_pillar")
93 yield True
94 LOG.info("Disable openstack_upgrade_enabled in reclass")
95 reclass_actions.add_bool_key(param, "False", context_file)
96 salt_actions.run_state("*", "saltutil.refresh_pillar")
97
98
99@pytest.mark.usefixtures("switch_to_proposed_pipelines")
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300100class TestUpdateMcpCluster(object):
101 """
102 Following the steps in
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300103 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update.html#minor-update
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300104 """
105
106 @pytest.mark.grab_versions
107 @pytest.mark.parametrize("_", [settings.ENV_NAME])
108 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300109 def test_update_drivetrain(self, salt_actions, drivetrain_actions,
Hanna Arhipova19429962019-10-17 15:16:49 +0300110 show_step, _):
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300111 """Updating DriveTrain component to release/proposed/2019.2.0 version
112
113 Scenario:
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300114 1. Add workaround for PROD-32751
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300115 2. Run job git-mirror-downstream-mk-pipelines
116 3. Run job git-mirror-downstream-pipeline-library
117 4. If jobs are passed then start 'Deploy - upgrade MCP Drivetrain'
118
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300119 Duration: ~70 min
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300120 """
121 salt = salt_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300122 dt = drivetrain_actions
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300123
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300124 # #################### Add workaround for PROD-32751 #################
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300125 show_step(1)
126
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300127 # FIXME: workaround for PROD-32751
128 salt.cmd_run("cfg01*", "cd /srv/salt/reclass; git add -u && \
129 git commit --allow-empty -m 'Cluster model update'")
130
131 # ################### Downstream mk-pipelines #########################
132 show_step(2)
133 job_name = 'git-mirror-downstream-mk-pipelines'
134 job_parameters = {
135 'BRANCHES': 'release/proposed/2019.2.0'
136 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300137 update_pipelines = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300138 job_name=job_name,
139 job_parameters=job_parameters)
140
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300141 assert update_pipelines == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300142
143 # ################### Downstream pipeline-library ####################
144 show_step(3)
145 job_name = 'git-mirror-downstream-pipeline-library'
146 job_parameters = {
147 'BRANCHES': 'release/proposed/2019.2.0'
148 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300149 update_pipeline_library = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300150 job_name=job_name,
151 job_parameters=job_parameters)
152
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300153 assert update_pipeline_library == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300154
155 # ################### Start 'Deploy - upgrade MCP Drivetrain' job #####
156 show_step(4)
157
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300158 job_name = 'upgrade-mcp-release'
159 job_parameters = {
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300160 'GIT_REFSPEC': 'release/proposed/2019.2.0',
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300161 'MK_PIPELINES_REFSPEC': 'release/proposed/2019.2.0',
162 'TARGET_MCP_VERSION': '2019.2.0'
163 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300164 update_drivetrain = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300165 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300166 job_parameters=job_parameters,
Hanna Arhipova19429962019-10-17 15:16:49 +0300167 build_timeout=90 * 60)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300168
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300169 assert update_drivetrain == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300170
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300171 @pytest.mark.grab_versions
172 @pytest.mark.parametrize("_", [settings.ENV_NAME])
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300173 @pytest.mark.run_mcp_update
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300174 def test_update_glusterfs(self, salt_actions, reclass_actions,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300175 drivetrain_actions, show_step, _):
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300176 """ Upgrade GlusterFS
177 Scenario:
178 1. In infra/init.yml in Reclass, add the glusterfs_version parameter
179 2. Start linux.system.repo state
180 3. Start "update-glusterfs" job
181 4. Check version for GlusterFS servers
182 5. Check version for GlusterFS clients
183
184 """
185 salt = salt_actions
186 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300187 dt = drivetrain_actions
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300188
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300189 # ############## Change reclass ######################################
190 show_step(1)
191 reclass.add_key(
192 "parameters._param.linux_system_repo_mcp_glusterfs_version_number",
193 "5",
194 "cluster/*/infra/init.yml"
195 )
196 # ################# Run linux.system state ###########################
197 show_step(2)
198 salt.enforce_state("*", "linux.system.repo")
199
200 # ############## Start deploy-upgrade-galera job #####################
201 show_step(3)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300202 job_name = 'update-glusterfs'
203
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300204 update_glusterfs = dt.start_job_on_cid_jenkins(
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300205 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300206 build_timeout=40 * 60)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300207
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300208 assert update_glusterfs == 'SUCCESS'
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300209
210 # ################ Check GlusterFS version for servers ##############
211 show_step(4)
212 gluster_server_versions_by_nodes = salt.cmd_run(
213 "I@glusterfs:server",
214 "glusterd --version|head -n1")[0]
215
Hanna Arhipova19429962019-10-17 15:16:49 +0300216 assert has_only_similar(gluster_server_versions_by_nodes), \
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300217 gluster_server_versions_by_nodes
218
219 # ################ Check GlusterFS version for clients ##############
220 show_step(5)
221 gluster_client_versions_by_nodes = salt.cmd_run(
222 "I@glusterfs:client",
223 "glusterfs --version|head -n1")[0]
224
225 assert has_only_similar(gluster_client_versions_by_nodes), \
226 gluster_client_versions_by_nodes
227
228 @pytest.mark.grab_versions
229 @pytest.mark.parametrize("_", [settings.ENV_NAME])
230 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300231 def test_update_galera(self, salt_actions, reclass_actions,
232 drivetrain_actions, show_step, _):
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300233 """ Upgrade Galera automatically
234
235 Scenario:
236 1. Include the Galera upgrade pipeline job to DriveTrain
237 2. Apply the jenkins.client state on the Jenkins nodes
238 3. set the openstack_upgrade_enabled parameter to true
239 4. Refresh pillars
240 5. Add repositories with new Galera packages
241 6. Start job from Jenkins
242 """
243 salt = salt_actions
244 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300245 dt = drivetrain_actions
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300246 # ################### Enable pipeline #################################
247 show_step(1)
248 reclass.add_class(
249 "system.jenkins.client.job.deploy.update.upgrade_galera",
250 "cluster/*/cicd/control/leader.yml")
251 show_step(2)
252 salt.enforce_state("I@jenkins:client", "jenkins.client")
253
254 # ############### Enable automatic upgrade ############################
255 show_step(3)
256 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
257 "True",
258 "cluster/*/infra/init.yml")
259
260 show_step(4)
Hanna Arhipova7cfeb072019-10-11 15:04:10 +0300261 salt.run_state("dbs*", "saltutil.refresh_pillar")
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300262
263 # ############# Add repositories with new Galera packages #######
264 show_step(5)
265 salt.enforce_state("dbs*", "linux.system.repo")
266 salt.enforce_state("cfg*", "salt.master")
267
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300268 # #################### Login Jenkins on cid01 node ###################
269 show_step(6)
270
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300271 job_name = 'deploy-upgrade-galera'
272 job_parameters = {
273 'INTERACTIVE': 'false'
274 }
275
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300276 update_galera = dt.start_job_on_cid_jenkins(
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300277 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300278 job_parameters=job_parameters,
279 build_timeout=40 * 60)
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300280
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300281 assert update_galera == 'SUCCESS'
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300282
283 @pytest.fixture
284 def disable_automatic_failover_neutron_for_test(self, salt_actions):
285 """
286 On each OpenStack controller node, modify the neutron.conf file
287 Restart the neutron-server service
288 """
Hanna Arhipova19429962019-10-17 15:16:49 +0300289
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300290 def comment_line(node, file_name, word):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300291 """
292 Adds '#' before the specific line in specific file
293
294 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300295 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300296 :param word: string, the begin of line which should be commented
297 :return: None
298 """
299 salt_actions.cmd_run(node,
300 "sed -i 's/^{word}/#{word}/' {file}".
301 format(word=word,
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300302 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300303
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300304 def add_line(node, file_name, line):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300305 """
306 Appends line to the end of file
307
308 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300309 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300310 :param line: string, line that should be added
311 :return: None
312 """
313 salt_actions.cmd_run(node, "echo {line} >> {file}".format(
Hanna Arhipova19429962019-10-17 15:16:49 +0300314 line=line,
315 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300316
317 neutron_conf = '/etc/neutron/neutron.conf'
318 neutron_server = "I@neutron:server"
319 # ######## Create backup for config file #######################
320 salt_actions.cmd_run(
321 neutron_server,
322 "cp -p {file} {file}.backup".format(file=neutron_conf))
323
324 # ## Change parameters in neutron.conf'
325 comment_line(neutron_server, neutron_conf,
Hanna Arhipova19429962019-10-17 15:16:49 +0300326 "allow_automatic_l3agent_failover", )
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300327 comment_line(neutron_server, neutron_conf,
328 "allow_automatic_dhcp_failover")
329 add_line(neutron_server, neutron_conf,
330 "allow_automatic_dhcp_failover = false")
331 add_line(neutron_server, neutron_conf,
332 "allow_automatic_l3agent_failover = false")
333
334 # ## Apply changed config to the neutron-server service
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300335 result = salt_actions.cmd_run(neutron_server,
336 "service neutron-server restart")
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300337 # TODO: add check that neutron-server is up and running
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300338 yield result
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300339 # ## Revert file changes
340 salt_actions.cmd_run(
341 neutron_server,
342 "cp -p {file}.backup {file}".format(file=neutron_conf))
343 salt_actions.cmd_run(neutron_server,
344 "service neutron-server restart")
345
346 @pytest.fixture
347 def disable_neutron_agents_for_test(self, salt_actions):
348 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300349 Disable the neutron services before the test and
350 enable it after test
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300351 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300352 result = salt_actions.cmd_run("I@neutron:server", """
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300353 service neutron-dhcp-agent stop && \
354 service neutron-l3-agent stop && \
355 service neutron-metadata-agent stop && \
356 service neutron-openvswitch-agent stop
357 """)
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300358 yield result
359 #
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300360 salt_actions.cmd_run("I@neutron:server", """
361 service neutron-dhcp-agent start && \
362 service neutron-l3-agent start && \
363 service neutron-metadata-agent start && \
364 service neutron-openvswitch-agent start
365 """)
366 # TODO: add check that all services are UP and running
367
368 @pytest.mark.grab_versions
369 @pytest.mark.parametrize("_", [settings.ENV_NAME])
370 @pytest.mark.run_mcp_update
371 def test_update_rabbit(self, salt_actions, reclass_actions,
372 drivetrain_actions, show_step, _,
373 disable_automatic_failover_neutron_for_test,
374 disable_neutron_agents_for_test):
375 """ Updates RabbitMQ
376 Scenario:
377 1. Include the RabbitMQ upgrade pipeline job to DriveTrain
378 2. Add repositories with new RabbitMQ packages
379 3. Start Deploy - upgrade RabbitMQ pipeline
380
381 Updating RabbitMq should be completed before the OpenStack updating
382 process starts
383 """
384 salt = salt_actions
385 reclass = reclass_actions
386 dt = drivetrain_actions
387
388 # ####### Include the RabbitMQ upgrade pipeline job to DriveTrain ####
389 show_step(1)
390 reclass.add_class(
391 "system.jenkins.client.job.deploy.update.upgrade_rabbitmq",
392 "cluster/*/cicd/control/leader.yml")
393 salt.enforce_state("I@jenkins:client", "jenkins.client")
394
395 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
396 "True",
397 "cluster/*/infra/init.yml")
398 salt.run_state("I@rabbitmq:server", "saltutil.refresh_pillar")
399
400 # ########### Add repositories with new RabbitMQ packages ############
401 show_step(2)
402 salt.enforce_state("I@rabbitmq:server", "linux.system.repo")
403
404 # ########### Start Deploy - upgrade RabbitMQ pipeline ############
405 show_step(3)
406 job_parameters = {
407 'INTERACTIVE': 'false'
408 }
409
410 update_rabbit = dt.start_job_on_cid_jenkins(
411 job_name='deploy-upgrade-rabbitmq',
412 job_parameters=job_parameters,
413 build_timeout=40 * 60
414 )
415 assert update_rabbit == 'SUCCESS'
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300416
417 @pytest.mark.grab_versions
418 @pytest.mark.parametrize("_", [settings.ENV_NAME])
419 @pytest.mark.run_mcp_update
420 def test_update_ceph(self, salt_actions, drivetrain_actions, show_step, _):
421 """ Updates Ceph to the latest minor version
422
423 Scenario:
424 1. Add workaround for unhealth Ceph
425 2. Start ceph-upgrade job with default parameters
426 3. Check Ceph version for all nodes
427
428 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update/ceph-update.html
429 """
430 salt = salt_actions
431 dt = drivetrain_actions
432
433 # ###################### Add workaround for unhealth Ceph ############
434 show_step(1)
435 salt.cmd_run("I@ceph:radosgw",
436 "ceph config set 'mon pg warn max object skew' 20")
437 # ###################### Start ceph-upgrade pipeline #################
438 show_step(2)
439 job_parameters = {}
440
441 update_ceph = dt.start_job_on_cid_jenkins(
442 job_name='ceph-update',
443 job_parameters=job_parameters)
444
445 assert update_ceph == 'SUCCESS'
446
447 # ########## Verify Ceph version #####################################
448 show_step(3)
449
450 ceph_version_by_nodes = salt.cmd_run(
Hanna Arhipova19429962019-10-17 15:16:49 +0300451 "I@ceph:* and not I@ceph:monitoring and not I@ceph:backup:server",
452 "ceph version")[0]
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300453
454 assert has_only_similar(ceph_version_by_nodes), ceph_version_by_nodes
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300455
456
Hanna Arhipova19429962019-10-17 15:16:49 +0300457@pytest.mark.usefixtures("switch_to_proposed_pipelines",
458 "enable_openstack_update")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300459class TestOpenstackUpdate(object):
460
461 @pytest.mark.grab_versions
462 @pytest.mark.run_mcp_update
463 def test__pre_update__enable_pipeline_job(self,
464 reclass_actions, salt_actions,
465 show_step):
466 """ Enable pipeline in the Drivetrain
467
468 Scenario:
469 1. Add deploy.update.* classes to the reclass
470 2. Start jenkins.client salt state
471
472 """
473 salt = salt_actions
474 reclass = reclass_actions
475 show_step(1)
476 reclass.add_class("system.jenkins.client.job.deploy.update.upgrade",
477 "cluster/*/cicd/control/leader.yml")
478
479 reclass.add_class(
480 "system.jenkins.client.job.deploy.update.upgrade_ovs_gateway",
481 "cluster/*/cicd/control/leader.yml")
482
483 reclass.add_class(
484 "system.jenkins.client.job.deploy.update.upgrade_compute",
485 "cluster/*/cicd/control/leader.yml")
486
487 show_step(2)
488 r, errors = salt.enforce_state("I@jenkins:client", "jenkins.client")
489 assert errors is None
490
491 @pytest.mark.grab_versions
492 @pytest.mark.parametrize('target', get_control_plane_targets())
493 @pytest.mark.run_mcp_update
Hanna Arhipova19429962019-10-17 15:16:49 +0300494 def test__update__control_plane(self, drivetrain_actions, target):
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300495 """Start 'Deploy - upgrade control VMs' for specific node
496 """
497 job_parameters = {
498 "TARGET_SERVERS": target,
499 "INTERACTIVE": False}
500 upgrade_control_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
501 job_name="deploy-upgrade-control",
502 job_parameters=job_parameters)
503
504 assert upgrade_control_pipeline == 'SUCCESS'
505
506 @pytest.mark.grab_versions
507 @pytest.mark.run_mcp_update
508 def test__update__data_plane(self, drivetrain_actions):
509 """Start 'Deploy - upgrade OVS gateway'
510 """
511 job_parameters = {
512 "INTERACTIVE": False}
513 upgrade_data_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
514 job_name="deploy-upgrade-ovs-gateway",
515 job_parameters=job_parameters)
516
517 assert upgrade_data_pipeline == 'SUCCESS'
Hanna Arhipova19429962019-10-17 15:16:49 +0300518
519 @pytest.mark.grab_versions
520 @pytest.mark.run_mcp_update
521 def test__update__computes(self, drivetrain_actions):
522 """Start 'Deploy - upgrade computes'
523 """
524 job_parameters = {
525 "INTERACTIVE": False}
526 upgrade_compute_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
527 job_name="deploy-upgrade-compute",
528 job_parameters=job_parameters)
529
530 assert upgrade_compute_pipeline == 'SUCCESS'