blob: 83fdb0acdc3aba4f0f99a066489395da3dc5aac4 [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
Hanna Arhipova75f21bb2019-10-07 19:22:15 +030046 # check for Manila existence
47 # if saltmanager.get_single_pillar("I@salt:master",
48 # "_param:manila_service_protocol"):
49 # targets.append('share*')
50
51 # check for Tenant Telemetry existence
52 if saltmanager.get_single_pillar("I@salt:master",
53 "_param:openstack_telemetry_hostname"):
54 targets.append('mdb*')
55
56 # check for Barbican existence
57 if saltmanager.get_single_pillar("I@salt:master",
58 "_param:barbican_enabled"):
59 targets.append('kmn*')
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030060 return targets
61
62
Hanna Arhipova19429962019-10-17 15:16:49 +030063@pytest.fixture(scope='class')
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030064def switch_to_proposed_pipelines(reclass_actions, salt_actions):
Hanna Arhipova19429962019-10-17 15:16:49 +030065 reclass = reclass_actions
66 proposed_repo = "http://mirror.mirantis.com/update/proposed/"
67 repo_param = "parameters._param.linux_system_repo_update_url"
Hanna Arhipova7cfeb072019-10-11 15:04:10 +030068
Hanna Arhipova19429962019-10-17 15:16:49 +030069 proposed_pipeline_branch = "release/proposed/2019.2.0"
70 pipeline_branch_param = "parameters._param.jenkins_pipelines_branch"
71 infra_yml = "cluster/*/infra/init.yml"
72
73 LOG.info("Check reclass has release/proposed/2019.2.0 branches")
74 if reclass.get_key(pipeline_branch_param,
75 infra_yml) == proposed_pipeline_branch \
76 and reclass.get_key(repo_param, infra_yml) == proposed_repo:
77 return True
78
79 LOG.info("Switch to release/proposed/2019.2.0 branches")
80 reclass.add_key(pipeline_branch_param, proposed_pipeline_branch, infra_yml)
81
82 reclass.add_key(repo_param, proposed_repo, infra_yml)
83 reclass.add_key(repo_param, proposed_repo, "cluster/*/openstack/init.yml")
84 reclass.add_key(repo_param, proposed_repo, "cluster/*/stacklight/init.yml")
85 reclass.add_key(repo_param, proposed_repo, "cluster/*/ceph/init.yml")
Hanna Arhipova7cfeb072019-10-11 15:04:10 +030086
87 salt_actions.run_state("*", "saltutil.refresh_pillar")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030088 salt_actions.enforce_state("I@jenkins:client", "jenkins.client")
89
90
Hanna Arhipova19429962019-10-17 15:16:49 +030091@pytest.fixture(scope='class')
92def enable_openstack_update(reclass_actions, salt_actions):
93 param = "parameters._param.openstack_upgrade_enabled"
94 context_file = "cluster/*/infra/init.yml"
95
96 LOG.info("Enable openstack_upgrade_enabled in reclass")
97 reclass_actions.add_bool_key(param, "True", context_file)
98 salt_actions.run_state("*", "saltutil.refresh_pillar")
99 yield True
100 LOG.info("Disable openstack_upgrade_enabled in reclass")
101 reclass_actions.add_bool_key(param, "False", context_file)
102 salt_actions.run_state("*", "saltutil.refresh_pillar")
103
104
105@pytest.mark.usefixtures("switch_to_proposed_pipelines")
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300106class TestUpdateMcpCluster(object):
107 """
108 Following the steps in
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300109 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update.html#minor-update
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300110 """
111
112 @pytest.mark.grab_versions
113 @pytest.mark.parametrize("_", [settings.ENV_NAME])
114 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300115 def test_update_drivetrain(self, salt_actions, drivetrain_actions,
Hanna Arhipova19429962019-10-17 15:16:49 +0300116 show_step, _):
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300117 """Updating DriveTrain component to release/proposed/2019.2.0 version
118
119 Scenario:
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300120 1. Add workaround for PROD-32751
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300121 2. Run job git-mirror-downstream-mk-pipelines
122 3. Run job git-mirror-downstream-pipeline-library
123 4. If jobs are passed then start 'Deploy - upgrade MCP Drivetrain'
124
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300125 Duration: ~70 min
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300126 """
127 salt = salt_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300128 dt = drivetrain_actions
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300129
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300130 # #################### Add workaround for PROD-32751 #################
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300131 show_step(1)
132
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300133 # FIXME: workaround for PROD-32751
134 salt.cmd_run("cfg01*", "cd /srv/salt/reclass; git add -u && \
135 git commit --allow-empty -m 'Cluster model update'")
136
137 # ################### Downstream mk-pipelines #########################
138 show_step(2)
139 job_name = 'git-mirror-downstream-mk-pipelines'
140 job_parameters = {
141 'BRANCHES': 'release/proposed/2019.2.0'
142 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300143 update_pipelines = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300144 job_name=job_name,
145 job_parameters=job_parameters)
146
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300147 assert update_pipelines == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300148
149 # ################### Downstream pipeline-library ####################
150 show_step(3)
151 job_name = 'git-mirror-downstream-pipeline-library'
152 job_parameters = {
153 'BRANCHES': 'release/proposed/2019.2.0'
154 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300155 update_pipeline_library = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300156 job_name=job_name,
157 job_parameters=job_parameters)
158
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300159 assert update_pipeline_library == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300160
161 # ################### Start 'Deploy - upgrade MCP Drivetrain' job #####
162 show_step(4)
163
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300164 job_name = 'upgrade-mcp-release'
165 job_parameters = {
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300166 'GIT_REFSPEC': 'release/proposed/2019.2.0',
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300167 'MK_PIPELINES_REFSPEC': 'release/proposed/2019.2.0',
168 'TARGET_MCP_VERSION': '2019.2.0'
169 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300170 update_drivetrain = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300171 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300172 job_parameters=job_parameters,
Hanna Arhipova19429962019-10-17 15:16:49 +0300173 build_timeout=90 * 60)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300174
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300175 assert update_drivetrain == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300176
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300177 @pytest.mark.grab_versions
178 @pytest.mark.parametrize("_", [settings.ENV_NAME])
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300179 @pytest.mark.run_mcp_update
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300180 def test_update_glusterfs(self, salt_actions, reclass_actions,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300181 drivetrain_actions, show_step, _):
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300182 """ Upgrade GlusterFS
183 Scenario:
184 1. In infra/init.yml in Reclass, add the glusterfs_version parameter
185 2. Start linux.system.repo state
186 3. Start "update-glusterfs" job
187 4. Check version for GlusterFS servers
188 5. Check version for GlusterFS clients
189
190 """
191 salt = salt_actions
192 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300193 dt = drivetrain_actions
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300194
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300195 # ############## Change reclass ######################################
196 show_step(1)
197 reclass.add_key(
198 "parameters._param.linux_system_repo_mcp_glusterfs_version_number",
199 "5",
200 "cluster/*/infra/init.yml"
201 )
202 # ################# Run linux.system state ###########################
203 show_step(2)
204 salt.enforce_state("*", "linux.system.repo")
205
206 # ############## Start deploy-upgrade-galera job #####################
207 show_step(3)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300208 job_name = 'update-glusterfs'
209
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300210 update_glusterfs = dt.start_job_on_cid_jenkins(
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300211 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300212 build_timeout=40 * 60)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300213
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300214 assert update_glusterfs == 'SUCCESS'
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300215
216 # ################ Check GlusterFS version for servers ##############
217 show_step(4)
218 gluster_server_versions_by_nodes = salt.cmd_run(
219 "I@glusterfs:server",
220 "glusterd --version|head -n1")[0]
221
Hanna Arhipova19429962019-10-17 15:16:49 +0300222 assert has_only_similar(gluster_server_versions_by_nodes), \
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300223 gluster_server_versions_by_nodes
224
225 # ################ Check GlusterFS version for clients ##############
226 show_step(5)
227 gluster_client_versions_by_nodes = salt.cmd_run(
228 "I@glusterfs:client",
229 "glusterfs --version|head -n1")[0]
230
231 assert has_only_similar(gluster_client_versions_by_nodes), \
232 gluster_client_versions_by_nodes
233
234 @pytest.mark.grab_versions
235 @pytest.mark.parametrize("_", [settings.ENV_NAME])
236 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300237 def test_update_galera(self, salt_actions, reclass_actions,
238 drivetrain_actions, show_step, _):
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300239 """ Upgrade Galera automatically
240
241 Scenario:
242 1. Include the Galera upgrade pipeline job to DriveTrain
243 2. Apply the jenkins.client state on the Jenkins nodes
244 3. set the openstack_upgrade_enabled parameter to true
245 4. Refresh pillars
246 5. Add repositories with new Galera packages
247 6. Start job from Jenkins
248 """
249 salt = salt_actions
250 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300251 dt = drivetrain_actions
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300252 # ################### Enable pipeline #################################
253 show_step(1)
254 reclass.add_class(
255 "system.jenkins.client.job.deploy.update.upgrade_galera",
256 "cluster/*/cicd/control/leader.yml")
257 show_step(2)
258 salt.enforce_state("I@jenkins:client", "jenkins.client")
259
260 # ############### Enable automatic upgrade ############################
261 show_step(3)
262 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
263 "True",
264 "cluster/*/infra/init.yml")
265
266 show_step(4)
Hanna Arhipova7cfeb072019-10-11 15:04:10 +0300267 salt.run_state("dbs*", "saltutil.refresh_pillar")
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300268
269 # ############# Add repositories with new Galera packages #######
270 show_step(5)
271 salt.enforce_state("dbs*", "linux.system.repo")
272 salt.enforce_state("cfg*", "salt.master")
273
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300274 # #################### Login Jenkins on cid01 node ###################
275 show_step(6)
276
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300277 job_name = 'deploy-upgrade-galera'
278 job_parameters = {
279 'INTERACTIVE': 'false'
280 }
281
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300282 update_galera = dt.start_job_on_cid_jenkins(
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300283 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300284 job_parameters=job_parameters,
285 build_timeout=40 * 60)
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300286
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300287 assert update_galera == 'SUCCESS'
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300288
289 @pytest.fixture
290 def disable_automatic_failover_neutron_for_test(self, salt_actions):
291 """
292 On each OpenStack controller node, modify the neutron.conf file
293 Restart the neutron-server service
294 """
Hanna Arhipova19429962019-10-17 15:16:49 +0300295
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300296 def comment_line(node, file_name, word):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300297 """
298 Adds '#' before the specific line in specific file
299
300 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300301 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300302 :param word: string, the begin of line which should be commented
303 :return: None
304 """
305 salt_actions.cmd_run(node,
306 "sed -i 's/^{word}/#{word}/' {file}".
307 format(word=word,
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300308 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300309
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300310 def add_line(node, file_name, line):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300311 """
312 Appends line to the end of file
313
314 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300315 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300316 :param line: string, line that should be added
317 :return: None
318 """
319 salt_actions.cmd_run(node, "echo {line} >> {file}".format(
Hanna Arhipova19429962019-10-17 15:16:49 +0300320 line=line,
321 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300322
323 neutron_conf = '/etc/neutron/neutron.conf'
324 neutron_server = "I@neutron:server"
325 # ######## Create backup for config file #######################
326 salt_actions.cmd_run(
327 neutron_server,
328 "cp -p {file} {file}.backup".format(file=neutron_conf))
329
330 # ## Change parameters in neutron.conf'
331 comment_line(neutron_server, neutron_conf,
Hanna Arhipova19429962019-10-17 15:16:49 +0300332 "allow_automatic_l3agent_failover", )
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300333 comment_line(neutron_server, neutron_conf,
334 "allow_automatic_dhcp_failover")
335 add_line(neutron_server, neutron_conf,
336 "allow_automatic_dhcp_failover = false")
337 add_line(neutron_server, neutron_conf,
338 "allow_automatic_l3agent_failover = false")
339
340 # ## Apply changed config to the neutron-server service
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300341 result = salt_actions.cmd_run(neutron_server,
342 "service neutron-server restart")
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300343 # TODO: add check that neutron-server is up and running
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300344 yield result
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300345 # ## Revert file changes
346 salt_actions.cmd_run(
347 neutron_server,
348 "cp -p {file}.backup {file}".format(file=neutron_conf))
349 salt_actions.cmd_run(neutron_server,
350 "service neutron-server restart")
351
352 @pytest.fixture
353 def disable_neutron_agents_for_test(self, salt_actions):
354 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300355 Disable the neutron services before the test and
356 enable it after test
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300357 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300358 result = salt_actions.cmd_run("I@neutron:server", """
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300359 service neutron-dhcp-agent stop && \
360 service neutron-l3-agent stop && \
361 service neutron-metadata-agent stop && \
362 service neutron-openvswitch-agent stop
363 """)
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300364 yield result
365 #
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300366 salt_actions.cmd_run("I@neutron:server", """
367 service neutron-dhcp-agent start && \
368 service neutron-l3-agent start && \
369 service neutron-metadata-agent start && \
370 service neutron-openvswitch-agent start
371 """)
372 # TODO: add check that all services are UP and running
373
374 @pytest.mark.grab_versions
375 @pytest.mark.parametrize("_", [settings.ENV_NAME])
376 @pytest.mark.run_mcp_update
377 def test_update_rabbit(self, salt_actions, reclass_actions,
378 drivetrain_actions, show_step, _,
379 disable_automatic_failover_neutron_for_test,
380 disable_neutron_agents_for_test):
381 """ Updates RabbitMQ
382 Scenario:
383 1. Include the RabbitMQ upgrade pipeline job to DriveTrain
384 2. Add repositories with new RabbitMQ packages
385 3. Start Deploy - upgrade RabbitMQ pipeline
386
387 Updating RabbitMq should be completed before the OpenStack updating
388 process starts
389 """
390 salt = salt_actions
391 reclass = reclass_actions
392 dt = drivetrain_actions
393
394 # ####### Include the RabbitMQ upgrade pipeline job to DriveTrain ####
395 show_step(1)
396 reclass.add_class(
397 "system.jenkins.client.job.deploy.update.upgrade_rabbitmq",
398 "cluster/*/cicd/control/leader.yml")
399 salt.enforce_state("I@jenkins:client", "jenkins.client")
400
401 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
402 "True",
403 "cluster/*/infra/init.yml")
404 salt.run_state("I@rabbitmq:server", "saltutil.refresh_pillar")
405
406 # ########### Add repositories with new RabbitMQ packages ############
407 show_step(2)
408 salt.enforce_state("I@rabbitmq:server", "linux.system.repo")
409
410 # ########### Start Deploy - upgrade RabbitMQ pipeline ############
411 show_step(3)
412 job_parameters = {
413 'INTERACTIVE': 'false'
414 }
415
416 update_rabbit = dt.start_job_on_cid_jenkins(
417 job_name='deploy-upgrade-rabbitmq',
418 job_parameters=job_parameters,
419 build_timeout=40 * 60
420 )
421 assert update_rabbit == 'SUCCESS'
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300422
423 @pytest.mark.grab_versions
424 @pytest.mark.parametrize("_", [settings.ENV_NAME])
425 @pytest.mark.run_mcp_update
426 def test_update_ceph(self, salt_actions, drivetrain_actions, show_step, _):
427 """ Updates Ceph to the latest minor version
428
429 Scenario:
430 1. Add workaround for unhealth Ceph
431 2. Start ceph-upgrade job with default parameters
432 3. Check Ceph version for all nodes
433
434 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update/ceph-update.html
435 """
436 salt = salt_actions
437 dt = drivetrain_actions
438
439 # ###################### Add workaround for unhealth Ceph ############
440 show_step(1)
441 salt.cmd_run("I@ceph:radosgw",
442 "ceph config set 'mon pg warn max object skew' 20")
443 # ###################### Start ceph-upgrade pipeline #################
444 show_step(2)
445 job_parameters = {}
446
447 update_ceph = dt.start_job_on_cid_jenkins(
448 job_name='ceph-update',
449 job_parameters=job_parameters)
450
451 assert update_ceph == 'SUCCESS'
452
453 # ########## Verify Ceph version #####################################
454 show_step(3)
455
456 ceph_version_by_nodes = salt.cmd_run(
Hanna Arhipova19429962019-10-17 15:16:49 +0300457 "I@ceph:* and not I@ceph:monitoring and not I@ceph:backup:server",
458 "ceph version")[0]
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300459
460 assert has_only_similar(ceph_version_by_nodes), ceph_version_by_nodes
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300461
Hanna Arhipovaac008562019-10-17 11:54:23 +0300462 @pytest.mark.grab_versions
463 @pytest.mark.parametrize("_", [settings.ENV_NAME])
464 @pytest.mark.run_mcp_update
465 def test_update_stacklight(self, _, drivetrain_actions):
466 """ Update packages for Stacklight
467 Scenario:
468 1. Start Deploy - upgrade Stacklight job
469 """
470 drivetrain = drivetrain_actions
471
472 job_parameters = {
473 "STAGE_UPGRADE_DOCKER_COMPONENTS": True,
474 "STAGE_UPGRADE_ES_KIBANA": True,
475 "STAGE_UPGRADE_SYSTEM_PART": True
476 }
477 upgrade_control_pipeline = drivetrain.start_job_on_cid_jenkins(
478 job_name="stacklight-upgrade",
479 job_parameters=job_parameters)
480
481 assert upgrade_control_pipeline == 'SUCCESS'
482
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300483
Hanna Arhipova19429962019-10-17 15:16:49 +0300484@pytest.mark.usefixtures("switch_to_proposed_pipelines",
485 "enable_openstack_update")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300486class TestOpenstackUpdate(object):
487
488 @pytest.mark.grab_versions
489 @pytest.mark.run_mcp_update
490 def test__pre_update__enable_pipeline_job(self,
491 reclass_actions, salt_actions,
492 show_step):
493 """ Enable pipeline in the Drivetrain
494
495 Scenario:
496 1. Add deploy.update.* classes to the reclass
497 2. Start jenkins.client salt state
498
499 """
500 salt = salt_actions
501 reclass = reclass_actions
502 show_step(1)
503 reclass.add_class("system.jenkins.client.job.deploy.update.upgrade",
504 "cluster/*/cicd/control/leader.yml")
505
506 reclass.add_class(
507 "system.jenkins.client.job.deploy.update.upgrade_ovs_gateway",
508 "cluster/*/cicd/control/leader.yml")
509
510 reclass.add_class(
511 "system.jenkins.client.job.deploy.update.upgrade_compute",
512 "cluster/*/cicd/control/leader.yml")
513
514 show_step(2)
515 r, errors = salt.enforce_state("I@jenkins:client", "jenkins.client")
516 assert errors is None
517
518 @pytest.mark.grab_versions
519 @pytest.mark.parametrize('target', get_control_plane_targets())
520 @pytest.mark.run_mcp_update
Hanna Arhipova19429962019-10-17 15:16:49 +0300521 def test__update__control_plane(self, drivetrain_actions, target):
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300522 """Start 'Deploy - upgrade control VMs' for specific node
523 """
524 job_parameters = {
525 "TARGET_SERVERS": target,
526 "INTERACTIVE": False}
527 upgrade_control_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
528 job_name="deploy-upgrade-control",
529 job_parameters=job_parameters)
530
531 assert upgrade_control_pipeline == 'SUCCESS'
532
533 @pytest.mark.grab_versions
534 @pytest.mark.run_mcp_update
535 def test__update__data_plane(self, drivetrain_actions):
536 """Start 'Deploy - upgrade OVS gateway'
537 """
538 job_parameters = {
539 "INTERACTIVE": False}
540 upgrade_data_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
541 job_name="deploy-upgrade-ovs-gateway",
542 job_parameters=job_parameters)
543
544 assert upgrade_data_pipeline == 'SUCCESS'
Hanna Arhipova19429962019-10-17 15:16:49 +0300545
546 @pytest.mark.grab_versions
547 @pytest.mark.run_mcp_update
548 def test__update__computes(self, drivetrain_actions):
549 """Start 'Deploy - upgrade computes'
550 """
551 job_parameters = {
552 "INTERACTIVE": False}
553 upgrade_compute_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
554 job_name="deploy-upgrade-compute",
555 job_parameters=job_parameters)
556
557 assert upgrade_compute_pipeline == 'SUCCESS'