blob: 6556e5f813bd82ae2ccba3c3138e95f7d6b18762 [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()
Hanna Arhipova52bb17d2019-10-28 19:15:17 +020035 telemetry_exists = False
36 barbican_exists = False
Hanna Arhipovafbcea852019-10-03 13:24:53 +030037 try:
38 targets += saltmanager.run_state(
39 "I@keystone:server", 'test.ping')[0]['return'][0].keys()
40 targets += saltmanager.run_state(
41 "I@nginx:server and not I@salt:master",
42 "test.ping")[0]['return'][0].keys()
Hanna Arhipova4462dd02019-10-28 19:05:08 +020043 telemetry_exists = saltmanager.get_single_pillar(
44 "I@salt:master",
45 "_param:openstack_telemetry_hostname")
46 barbican_exists = saltmanager.get_single_pillar(
47 "I@salt:master",
48 "_param:barbican_enabled")
Hanna Arhipovafbcea852019-10-03 13:24:53 +030049 except BaseException as err:
50 LOG.warning("Can't retrieve data from Salt. \
51 Maybe cluster is not deployed completely.\
52 Err: {}".format(err))
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030053
Hanna Arhipova75f21bb2019-10-07 19:22:15 +030054 # check for Manila existence
55 # if saltmanager.get_single_pillar("I@salt:master",
56 # "_param:manila_service_protocol"):
57 # targets.append('share*')
58
59 # check for Tenant Telemetry existence
Hanna Arhipova4462dd02019-10-28 19:05:08 +020060 if telemetry_exists:
Hanna Arhipova75f21bb2019-10-07 19:22:15 +030061 targets.append('mdb*')
62
63 # check for Barbican existence
Hanna Arhipova4462dd02019-10-28 19:05:08 +020064 if barbican_exists:
Hanna Arhipova75f21bb2019-10-07 19:22:15 +030065 targets.append('kmn*')
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030066 return targets
67
68
Hanna Arhipova19429962019-10-17 15:16:49 +030069@pytest.fixture(scope='class')
Hanna Arhipovae1dd27a2021-07-28 12:40:40 +030070def update_to_tag(request):
71 return request.config.getoption("--update-to-tag")
Hanna Arhipova672efc62021-03-15 09:55:14 +020072
73
74@pytest.fixture(scope='class')
PGlazov7efe3b22022-02-16 17:29:05 +040075def update_mysql_to_version(request):
76 return request.config.getoption("--update-mysql-version")
77
78
79@pytest.fixture(scope='class')
Hanna Arhipova672efc62021-03-15 09:55:14 +020080def switch_to_proposed_pipelines(reclass_actions, salt_actions,
Hanna Arhipovae1dd27a2021-07-28 12:40:40 +030081 update_to_tag):
82 if update_to_tag:
Hanna Arhipova672efc62021-03-15 09:55:14 +020083 return True
84
Hanna Arhipova19429962019-10-17 15:16:49 +030085 reclass = reclass_actions
86 proposed_repo = "http://mirror.mirantis.com/update/proposed/"
87 repo_param = "parameters._param.linux_system_repo_update_url"
Hanna Arhipova7cfeb072019-10-11 15:04:10 +030088
Hanna Arhipova19429962019-10-17 15:16:49 +030089 proposed_pipeline_branch = "release/proposed/2019.2.0"
90 pipeline_branch_param = "parameters._param.jenkins_pipelines_branch"
91 infra_yml = "cluster/*/infra/init.yml"
92
93 LOG.info("Check reclass has release/proposed/2019.2.0 branches")
94 if reclass.get_key(pipeline_branch_param,
95 infra_yml) == proposed_pipeline_branch \
96 and reclass.get_key(repo_param, infra_yml) == proposed_repo:
97 return True
98
99 LOG.info("Switch to release/proposed/2019.2.0 branches")
100 reclass.add_key(pipeline_branch_param, proposed_pipeline_branch, infra_yml)
101
102 reclass.add_key(repo_param, proposed_repo, infra_yml)
103 reclass.add_key(repo_param, proposed_repo, "cluster/*/openstack/init.yml")
104 reclass.add_key(repo_param, proposed_repo, "cluster/*/stacklight/init.yml")
105 reclass.add_key(repo_param, proposed_repo, "cluster/*/ceph/init.yml")
Hanna Arhipova7cfeb072019-10-11 15:04:10 +0300106
107 salt_actions.run_state("*", "saltutil.refresh_pillar")
Hanna Arhipova9ee75902019-10-29 16:33:26 +0200108 salt_actions.enforce_state("*", "salt.minion")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300109 salt_actions.enforce_state("I@jenkins:client", "jenkins.client")
110
111
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400112@pytest.mark.parametrize("_", [settings.ENV_NAME])
113@pytest.fixture
114def wa_for_stacklight_monitor_hostname_prod37068(reclass_actions,
115 salt_actions):
116 stacklight_monitor_hostname = salt_actions.cmd_run(
117 "I@salt:master",
118 ". /root/venv-reclass-tools/bin/activate; "
119 "reclass-tools get-key "
120 "parameters.dogtag.server.stacklight_monitor_hostname "
121 "/srv/salt/reclass/classes/cluster/{env_name}"
122 "/openstack/barbican.yml".format(
123 env_name=settings.ENV_NAME))
124
125 if stacklight_monitor_hostname != '':
126 reclass_actions.add_key(
127 "parameters.dogtag.server.stacklight_monitor_hostname",
128 "mon",
129 "cluster/*/openstack/barbican.yml"
130 )
131 salt_actions.cmd_run("cfg01*",
132 "cd /srv/salt/reclass; git add -u && "
133 "git commit --allow-empty "
134 "-m 'fix stacklight_monitor_hostname "
135 "for dogtag'")
136 else:
137 LOG.info("Skipping WA stacklight_monitor_hostname fix prod37068")
138
139
Hanna Arhipova745fdbb2020-03-30 14:40:44 +0300140@pytest.fixture
Hanna Arhipovaec201e72020-10-26 17:14:25 +0200141def wa_for_galera_clustercheck_password_prod35705(reclass_actions,
142 salt_actions):
Hanna Arhipova0e816d22021-01-29 00:17:44 +0200143 tgt = "I@galera:master or I@galera:slave"
144 if not salt_actions.get_pillar(tgt,
145 "_param:galera_clustercheck_password")[0]:
146 reclass_actions.add_key(
147 "parameters._param.galera_clustercheck_password",
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400148 "a" * 32,
Hanna Arhipova0e816d22021-01-29 00:17:44 +0200149 "cluster/*/infra/secrets.yml")
150 salt_actions.run_state(tgt, "saltutil.refresh_pillar")
151 salt_actions.enforce_state(tgt, "galera")
152 salt_actions.enforce_state(tgt, "haproxy")
153 reclass_actions.commit(
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400154 "[from TCP-QA] Add galera_clustercheck_password")
Hanna Arhipova0e816d22021-01-29 00:17:44 +0200155 else:
Hanna Arhipova672efc62021-03-15 09:55:14 +0200156
Hanna Arhipova0e816d22021-01-29 00:17:44 +0200157 LOG.info("Skipping WA for Galera Clustercheck Password")
Hanna Arhipova745fdbb2020-03-30 14:40:44 +0300158
159
Hanna Arhipova97fac6e2020-12-03 13:10:56 +0200160@pytest.fixture
PGlazovf5977292021-11-25 19:38:27 +0400161def wa_cve_2021_20288_global_id_reclaim(reclass_actions,
162 salt_actions):
163 tgt = "I@ceph:common"
164 context_file = "cluster/*/ceph/common.yml"
165 if not reclass_actions.check_existence(
Pavel Glazov6ed8d442022-09-20 12:50:18 +0400166 'parameters.ceph.common.config.mon.' +
167 'auth_allow_insecure_global_id_reclaim'):
PGlazov4b013962022-01-31 14:01:42 +0400168 if salt_actions.get_single_pillar(
169 "I@ceph:mgr and *01.*",
170 "_param.ceph_version") == 'luminous':
171 LOG.info('Skip reclaim set')
172 return
PGlazovf5977292021-11-25 19:38:27 +0400173 reclass_actions.add_bool_key(
Pavel Glazov6ed8d442022-09-20 12:50:18 +0400174 'parameters.ceph.common.config.mon.' +
175 'auth_allow_insecure_global_id_reclaim', "False", context_file)
PGlazovf5977292021-11-25 19:38:27 +0400176 salt_actions.run_state(tgt, "state.apply", "ceph.common")
177 salt_actions.cmd_run(tgt, "systemctl restart ceph-mon.target")
178 else:
179 LOG.info("Skipping WA ceph set auth_allow_insecure_global_id_reclaim")
180
181
182@pytest.fixture
Hanna Arhipova97fac6e2020-12-03 13:10:56 +0200183def wa_for_alerta_password_prod35958(reclass_actions,
184 salt_actions):
Hanna Arhipova0e816d22021-01-29 00:17:44 +0200185 if not salt_actions.get_pillar("I@prometheus:alerta",
186 "_param:alerta_admin_api_key_generated")[0]:
187 reclass_actions.add_key(
188 "parameters._param.alerta_admin_api_key_generated",
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400189 "a" * 32,
Hanna Arhipova0e816d22021-01-29 00:17:44 +0200190 "cluster/*/infra/secrets.yml")
191 reclass_actions.add_key(
192 "parameters._param.alerta_admin_key",
193 "${_param:alerta_admin_api_key_generated}",
194 "cluster/*/stacklight/init.yml")
195 reclass_actions.commit("[from TCP-QA] Add alerta_admin_key")
196 salt_actions.run_state(
197 "I@prometheus:alerta or I@prometheus:alertmanager",
198 "saltutil.refresh_pillar")
199 salt_actions.enforce_state(
200 "I@prometheus:alerta", "prometheus.alerta")
201 salt_actions.enforce_state(
202 "I@prometheus:alertmanager", "prometheus.alertmanager")
203 salt_actions.enforce_state(
204 "I@prometheus:alerta or I@prometheus:alertmanager",
205 "docker.client")
206 else:
207 LOG.info("Skipping WA for Alerta API key")
Hanna Arhipova97fac6e2020-12-03 13:10:56 +0200208
209
Vladimir Khlyunev5fe0aaa2022-08-16 23:13:22 +0400210@pytest.fixture
211def wa_redis_server_version_3_prod36960(reclass_actions, salt_actions):
212 version_pillar = "redis:server:version"
213 tgt = "I@{}".format(version_pillar)
214 pillar_file = "cluster/*/openstack/telemetry.yml"
215 redis_target_version = "5.0"
216
217 msg_nodes = salt_actions.get_minions_by_target(tgt)
218 if not msg_nodes:
219 LOG.info("dbs* nodes not found, skipping")
220 return
221 else:
222 msg_node = msg_nodes[0]
223
224 if str(salt_actions.get_single_pillar(
225 msg_node,
226 version_pillar)) == redis_target_version:
227 LOG.info("Redis-server is already '{}', skipping".format(
228 redis_target_version))
229 return
230
231 LOG.info("Setting redis-server version to '{}'".format(
232 redis_target_version))
233 reclass_actions.add_key(
234 "parameters.{}".format(version_pillar.replace(":", ".")),
235 redis_target_version,
236 pillar_file)
237 salt_actions.run_state(" or ".join(msg_nodes),
238 "saltutil.refresh_pillar")
239
240
Hanna Arhipova19429962019-10-17 15:16:49 +0300241@pytest.fixture(scope='class')
242def enable_openstack_update(reclass_actions, salt_actions):
243 param = "parameters._param.openstack_upgrade_enabled"
244 context_file = "cluster/*/infra/init.yml"
245
246 LOG.info("Enable openstack_upgrade_enabled in reclass")
247 reclass_actions.add_bool_key(param, "True", context_file)
248 salt_actions.run_state("*", "saltutil.refresh_pillar")
249 yield True
250 LOG.info("Disable openstack_upgrade_enabled in reclass")
251 reclass_actions.add_bool_key(param, "False", context_file)
252 salt_actions.run_state("*", "saltutil.refresh_pillar")
253
254
Vladimir Khlyunev0ca3ba82022-10-31 12:12:30 +0400255@pytest.fixture(scope='class')
Pavel Glazov6ee164c2022-12-12 06:42:28 +0400256def switch_to_staging_updates_mirantis_repo(update_to_tag,
257 reclass_actions,
258 salt_actions):
Vladimir Khlyunev0ca3ba82022-10-31 12:12:30 +0400259 version_param = "parameters._param.updates_mirantis_version"
260 infra_yml = "cluster/*/infra/init.yml"
Vladimir Khlyunev0ca3ba82022-10-31 12:12:30 +0400261 current_version = reclass_actions.get_key(version_param, infra_yml)
Pavel Glazov6ee164c2022-12-12 06:42:28 +0400262
263 if update_to_tag is not None:
264 reclass_actions.add_key(version_param, update_to_tag, infra_yml)
Vladimir Khlyunev0ca3ba82022-10-31 12:12:30 +0400265 if current_version == 'staging':
266 LOG.info("updates.mirantis.com already set to 'staging', skipping")
267 return
268 if current_version is None:
269 LOG.info("updates.mirantis.com is not enabled, "
270 "skipping /staging repo pillar")
271 return
Pavel Glazov6ee164c2022-12-12 06:42:28 +0400272 if current_version is not None:
273 LOG.info("updates.mirantis.com is other tag "
274 "skipping /staging repo pillar")
275 salt_actions.run_state("*", "saltutil.refresh_pillar")
276 return
Vladimir Khlyunev0ca3ba82022-10-31 12:12:30 +0400277
278 LOG.info("Switch to updates.mirantis.com/staging repo")
279 reclass_actions.add_key(version_param, 'staging', infra_yml)
280
281 salt_actions.run_state("*", "saltutil.refresh_pillar")
282
283
Hanna Arhipova745fdbb2020-03-30 14:40:44 +0300284@pytest.mark.usefixtures("switch_to_proposed_pipelines",
Hanna Arhipovae1dd27a2021-07-28 12:40:40 +0300285 "update_to_tag",
Hanna Arhipova97fac6e2020-12-03 13:10:56 +0200286 "wa_for_galera_clustercheck_password_prod35705",
Vladimir Khlyunev5fe0aaa2022-08-16 23:13:22 +0400287 "wa_for_alerta_password_prod35958",
Vladimir Khlyunev0ca3ba82022-10-31 12:12:30 +0400288 "wa_redis_server_version_3_prod36960",
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400289 "wa_for_stacklight_monitor_hostname_prod37068",
Vladimir Khlyunev0ca3ba82022-10-31 12:12:30 +0400290 "switch_to_staging_updates_mirantis_repo")
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300291class TestUpdateMcpCluster(object):
292 """
293 Following the steps in
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300294 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update.html#minor-update
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300295 """
296
297 @pytest.mark.grab_versions
298 @pytest.mark.parametrize("_", [settings.ENV_NAME])
299 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300300 def test_update_drivetrain(self, salt_actions, drivetrain_actions,
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400301 show_step, update_to_tag, reclass_actions, _):
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300302 """Updating DriveTrain component to release/proposed/2019.2.0 version
303
304 Scenario:
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300305 1. Add workaround for PROD-32751
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300306 2. Run job git-mirror-downstream-mk-pipelines
307 3. Run job git-mirror-downstream-pipeline-library
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400308 4. Switch mcp-ci/pipeline-library to new version
309 5. Run job pre-upgrade-verify
310 6. If jobs are passed then start 'Deploy - upgrade MCP Drivetrain'
311 7. Wait till salt-master completes all async jobs
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300312
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300313 Duration: ~70 min
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300314 """
315 salt = salt_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300316 dt = drivetrain_actions
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300317
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300318 # #################### Add workaround for PROD-32751 #################
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300319 show_step(1)
320
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300321 # FIXME: workaround for PROD-32751
322 salt.cmd_run("cfg01*", "cd /srv/salt/reclass; git add -u && \
323 git commit --allow-empty -m 'Cluster model update'")
324
325 # ################### Downstream mk-pipelines #########################
326 show_step(2)
327 job_name = 'git-mirror-downstream-mk-pipelines'
328 job_parameters = {
Hanna Arhipovae1dd27a2021-07-28 12:40:40 +0300329 'BRANCHES': '*' or
330 'release/proposed/2019.2.0'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300331 }
Hanna Arhipova508f6532021-01-27 15:52:45 +0200332 job_result, job_description = dt.start_job_on_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300333 job_name=job_name,
Hanna Arhipovac3c59292020-04-23 16:29:09 +0300334 job_parameters=job_parameters,
335 verbose=True)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300336
Hanna Arhipova508f6532021-01-27 15:52:45 +0200337 assert job_result == 'SUCCESS', job_description
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300338
339 # ################### Downstream pipeline-library ####################
340 show_step(3)
341 job_name = 'git-mirror-downstream-pipeline-library'
342 job_parameters = {
Hanna Arhipovae1dd27a2021-07-28 12:40:40 +0300343 'BRANCHES': '*' or
344 'release/proposed/2019.2.0'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300345 }
Hanna Arhipova508f6532021-01-27 15:52:45 +0200346 job_result, job_description = dt.start_job_on_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300347 job_name=job_name,
Hanna Arhipovac3c59292020-04-23 16:29:09 +0300348 job_parameters=job_parameters,
349 verbose=True)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300350
Hanna Arhipova508f6532021-01-27 15:52:45 +0200351 assert job_result == 'SUCCESS', job_description
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300352
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400353 # ############### Switch mcp-ci/pipeline-library to new version########
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300354 show_step(4)
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400355
356 # https://docs.mirantis.com/mcp/q4-18/mcp-operations-guide/
357 # update-upgrade/minor-update/preupdate-drivetrain-verify.html
358 actual_piplines_version = salt.get_single_pillar(
359 "I@salt:master",
360 "_param:jenkins_pipelines_branch")
361 LOG.info(actual_piplines_version)
Pavel Glazov16d86e82023-03-30 15:06:14 +0400362 if update_to_tag is not None:
363 if actual_piplines_version != "refs/tags/{}".format(
364 update_to_tag):
365 reclass_actions.add_key(
366 'parameters._param.jenkins_pipelines_branch',
367 "refs/tags/{}".format(
368 update_to_tag),
369 'cluster/*/infra/init.yml')
370 salt.run_state("I@jenkins:client and not I@salt:master",
371 "saltutil.refresh_pillar")
372 salt_actions.enforce_state("I@jenkins:client:lib",
373 "jenkins.client.lib")
374 salt_actions.cmd_run("cfg01*",
375 "cd /srv/salt/reclass; git add -u && "
376 "git commit --allow-empty "
377 "-m 'use workaround for PROD-37068 "
378 "missing'")
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400379
380 # ############### Start 'Pre-upgrade verify' job (since 2019.2.17)#####
381 show_step(5)
dtsapikovcbff2332022-01-19 19:32:22 +0400382 job_name = 'pre-upgrade-verify'
383 job_parameters = {}
384
Pavel Glazov794b1a92022-10-03 16:33:04 +0400385 if (dt.check_job_exists_on_jenkins(job_name)):
dtsapikovcbff2332022-01-19 19:32:22 +0400386 LOG.info("Pre-upgrade verify job exists on Jenkins!")
387 job_result, job_description = dt.start_job_on_jenkins(
388 job_name=job_name,
389 job_parameters=job_parameters,
390 verbose=True,
391 build_timeout=4 * 60 * 60)
392
393 assert job_result == 'SUCCESS', job_description
394
395 # ################### Start 'Deploy - upgrade MCP Drivetrain' job #####
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400396 show_step(6)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300397
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300398 job_name = 'upgrade-mcp-release'
399 job_parameters = {
Hanna Arhipovae1dd27a2021-07-28 12:40:40 +0300400 'GIT_REFSPEC': update_to_tag or 'release/proposed/2019.2.0',
PGlazov1df9e542021-11-16 02:31:49 +0400401 'MK_PIPELINES_REFSPEC':
402 update_to_tag or 'release/proposed/2019.2.0',
Hanna Arhipovae1dd27a2021-07-28 12:40:40 +0300403 'TARGET_MCP_VERSION': update_to_tag or '2019.2.0',
Hanna Arhipova874c68f2021-03-29 15:57:19 +0300404 "DRIVE_TRAIN_PARAMS": {
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400405 "OS_DIST_UPGRADE": True,
406 "OS_UPGRADE": True,
407 "BATCH_SIZE": 10
408 }
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300409 }
Hanna Arhipova508f6532021-01-27 15:52:45 +0200410 job_result, job_description = dt.start_job_on_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300411 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300412 job_parameters=job_parameters,
Hanna Arhipovac3c59292020-04-23 16:29:09 +0300413 verbose=True,
Hanna Arhipovae7f2e322021-02-25 13:53:18 +0200414 build_timeout=4 * 60 * 60)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300415
Hanna Arhipova508f6532021-01-27 15:52:45 +0200416 assert job_result == 'SUCCESS', job_description
Hanna Arhipova7a593da2021-06-25 11:16:09 +0300417 # ############### Wait till salt-master completes all async jobs #####
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400418 show_step(7)
419 salt.wait_jobs_completed(timeout=20 * 60)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300420
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300421 @pytest.mark.grab_versions
422 @pytest.mark.parametrize("_", [settings.ENV_NAME])
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300423 @pytest.mark.run_mcp_update
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300424 def test_update_glusterfs(self, salt_actions, reclass_actions,
PGlazov7efe3b22022-02-16 17:29:05 +0400425 drivetrain_actions, show_step,
426 update_mysql_to_version, _):
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300427 """ Upgrade GlusterFS
428 Scenario:
429 1. In infra/init.yml in Reclass, add the glusterfs_version parameter
430 2. Start linux.system.repo state
431 3. Start "update-glusterfs" job
432 4. Check version for GlusterFS servers
433 5. Check version for GlusterFS clients
434
435 """
PGlazov7efe3b22022-02-16 17:29:05 +0400436
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300437 salt = salt_actions
438 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300439 dt = drivetrain_actions
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300440
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300441 # ############## Change reclass ######################################
442 show_step(1)
443 reclass.add_key(
444 "parameters._param.linux_system_repo_mcp_glusterfs_version_number",
445 "5",
446 "cluster/*/infra/init.yml"
447 )
448 # ################# Run linux.system state ###########################
449 show_step(2)
450 salt.enforce_state("*", "linux.system.repo")
451
452 # ############## Start deploy-upgrade-galera job #####################
453 show_step(3)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300454 job_name = 'update-glusterfs'
455
Hanna Arhipova508f6532021-01-27 15:52:45 +0200456 job_result, job_description = dt.start_job_on_jenkins(
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300457 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300458 build_timeout=40 * 60)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300459
Hanna Arhipova508f6532021-01-27 15:52:45 +0200460 assert job_result == 'SUCCESS', job_description
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300461
462 # ################ Check GlusterFS version for servers ##############
463 show_step(4)
464 gluster_server_versions_by_nodes = salt.cmd_run(
465 "I@glusterfs:server",
466 "glusterd --version|head -n1")[0]
467
Hanna Arhipova19429962019-10-17 15:16:49 +0300468 assert has_only_similar(gluster_server_versions_by_nodes), \
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300469 gluster_server_versions_by_nodes
470
471 # ################ Check GlusterFS version for clients ##############
472 show_step(5)
473 gluster_client_versions_by_nodes = salt.cmd_run(
474 "I@glusterfs:client",
475 "glusterfs --version|head -n1")[0]
476
477 assert has_only_similar(gluster_client_versions_by_nodes), \
478 gluster_client_versions_by_nodes
479
480 @pytest.mark.grab_versions
481 @pytest.mark.parametrize("_", [settings.ENV_NAME])
482 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300483 def test_update_galera(self, salt_actions, reclass_actions,
PGlazov7efe3b22022-02-16 17:29:05 +0400484 drivetrain_actions, show_step,
485 update_mysql_to_version, _):
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300486 """ Upgrade Galera automatically
487
488 Scenario:
489 1. Include the Galera upgrade pipeline job to DriveTrain
PGlazov7efe3b22022-02-16 17:29:05 +0400490 2. Add fix for mysql 5.7
491 3. Apply the jenkins.client state on the Jenkins nodes
492 4. set the openstack_upgrade_enabled parameter to true
493 5. Refresh pillars
494 6. Add repositories with new Galera packages
495 7. Start job from Jenkins
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300496 """
497 salt = salt_actions
498 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300499 dt = drivetrain_actions
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300500 # ################### Enable pipeline #################################
501 show_step(1)
502 reclass.add_class(
503 "system.jenkins.client.job.deploy.update.upgrade_galera",
504 "cluster/*/cicd/control/leader.yml")
PGlazov7efe3b22022-02-16 17:29:05 +0400505 # ################### Fix for Mysql 5.7 ##############################
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300506 show_step(2)
PGlazov7efe3b22022-02-16 17:29:05 +0400507 if (update_mysql_to_version == '5.7'):
PGlazov7efe3b22022-02-16 17:29:05 +0400508 mysql_class = "cluster.{env_name}.openstack." \
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400509 "database.mysql_version" \
PGlazov7efe3b22022-02-16 17:29:05 +0400510 .format(env_name=settings.ENV_NAME)
511 reclass.add_class(
512 mysql_class,
513 "cluster/*/openstack/database/master.yml")
514 reclass.add_class(
515 mysql_class,
516 "cluster/*/openstack/database/slave.yml")
517 mysql_path = "cluster/{env_name}" \
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400518 "/openstack/database/mysql_version.yml" \
PGlazov7efe3b22022-02-16 17:29:05 +0400519 .format(env_name=settings.ENV_NAME)
520 galera_mysql_version = '5.7'
521 if update_mysql_to_version != '5.7':
522 galera_mysql_version = update_mysql_to_version
523 mysql_version = "parameters:\n" \
524 " _param:\n" \
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400525 " galera_mysql_version: {}" \
PGlazov7efe3b22022-02-16 17:29:05 +0400526 .format(galera_mysql_version)
527 if not os.path.isfile("/srv/salt/reclass/classes/{path}".format(
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400528 path=mysql_path)):
PGlazov7efe3b22022-02-16 17:29:05 +0400529 reclass.create_yaml_with_context(mysql_version,
530 mysql_path)
531 else:
532 reclass.merge_context(mysql_version,
533 mysql_path)
534 reclass_actions.commit(
535 "[from TCP-QA] Change for mysql new version")
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300536
PGlazov7efe3b22022-02-16 17:29:05 +0400537 show_step(3)
Vladimir Khlyunev17468272022-06-29 16:19:36 +0400538 salt.run_state("I@jenkins:client and not I@salt:master",
539 "saltutil.refresh_pillar")
540 salt.enforce_state("I@jenkins:client and not I@salt:master",
541 "jenkins.client.job")
PGlazov7efe3b22022-02-16 17:29:05 +0400542 else:
543 LOG.info("Skip mysql upgrade fix")
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300544 # ############### Enable automatic upgrade ############################
PGlazov7efe3b22022-02-16 17:29:05 +0400545 show_step(4)
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300546 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
547 "True",
548 "cluster/*/infra/init.yml")
549
PGlazov7efe3b22022-02-16 17:29:05 +0400550 show_step(5)
Hanna Arhipova7cfeb072019-10-11 15:04:10 +0300551 salt.run_state("dbs*", "saltutil.refresh_pillar")
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300552
553 # ############# Add repositories with new Galera packages #######
PGlazov7efe3b22022-02-16 17:29:05 +0400554 show_step(6)
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300555 salt.enforce_state("dbs*", "linux.system.repo")
556 salt.enforce_state("cfg*", "salt.master")
557
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300558 # #################### Login Jenkins on cid01 node ###################
PGlazov7efe3b22022-02-16 17:29:05 +0400559 show_step(7)
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300560
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300561 job_name = 'deploy-upgrade-galera'
562 job_parameters = {
Hanna Arhipova874c68f2021-03-29 15:57:19 +0300563 'INTERACTIVE': 'false',
564 'OS_DIST_UPGRADE': 'true',
PGlazov7efe3b22022-02-16 17:29:05 +0400565 'OS_UPGRADE': 'true',
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300566 }
PGlazov554c4fd2022-03-23 14:31:41 +0400567 if (update_mysql_to_version == '5.7'):
PGlazov7efe3b22022-02-16 17:29:05 +0400568 job_parameters.update({'UPDATE_TO_MYSQL57': 'true'})
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300569
Hanna Arhipova508f6532021-01-27 15:52:45 +0200570 job_result, job_description = dt.start_job_on_jenkins(
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300571 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300572 job_parameters=job_parameters,
Pavel Glazov2e9cbcd2022-12-06 14:52:53 +0400573 build_timeout=60 * 60)
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300574
Hanna Arhipova508f6532021-01-27 15:52:45 +0200575 assert job_result == 'SUCCESS', job_description
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300576
577 @pytest.fixture
578 def disable_automatic_failover_neutron_for_test(self, salt_actions):
579 """
580 On each OpenStack controller node, modify the neutron.conf file
581 Restart the neutron-server service
582 """
Hanna Arhipova19429962019-10-17 15:16:49 +0300583
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300584 def comment_line(node, file_name, word):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300585 """
586 Adds '#' before the specific line in specific file
587
588 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300589 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300590 :param word: string, the begin of line which should be commented
591 :return: None
592 """
593 salt_actions.cmd_run(node,
594 "sed -i 's/^{word}/#{word}/' {file}".
595 format(word=word,
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300596 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300597
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300598 def add_line(node, file_name, line):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300599 """
600 Appends line to the end of file
601
602 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300603 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300604 :param line: string, line that should be added
605 :return: None
606 """
607 salt_actions.cmd_run(node, "echo {line} >> {file}".format(
Hanna Arhipova19429962019-10-17 15:16:49 +0300608 line=line,
609 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300610
611 neutron_conf = '/etc/neutron/neutron.conf'
612 neutron_server = "I@neutron:server"
613 # ######## Create backup for config file #######################
614 salt_actions.cmd_run(
615 neutron_server,
616 "cp -p {file} {file}.backup".format(file=neutron_conf))
617
618 # ## Change parameters in neutron.conf'
619 comment_line(neutron_server, neutron_conf,
Hanna Arhipova19429962019-10-17 15:16:49 +0300620 "allow_automatic_l3agent_failover", )
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300621 comment_line(neutron_server, neutron_conf,
622 "allow_automatic_dhcp_failover")
623 add_line(neutron_server, neutron_conf,
624 "allow_automatic_dhcp_failover = false")
625 add_line(neutron_server, neutron_conf,
626 "allow_automatic_l3agent_failover = false")
627
628 # ## Apply changed config to the neutron-server service
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300629 result = salt_actions.cmd_run(neutron_server,
630 "service neutron-server restart")
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300631 # TODO: add check that neutron-server is up and running
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300632 yield result
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300633 # ## Revert file changes
634 salt_actions.cmd_run(
635 neutron_server,
636 "cp -p {file}.backup {file}".format(file=neutron_conf))
637 salt_actions.cmd_run(neutron_server,
638 "service neutron-server restart")
639
640 @pytest.fixture
641 def disable_neutron_agents_for_test(self, salt_actions):
642 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300643 Disable the neutron services before the test and
644 enable it after test
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300645 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300646 result = salt_actions.cmd_run("I@neutron:server", """
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300647 service neutron-dhcp-agent stop && \
648 service neutron-l3-agent stop && \
649 service neutron-metadata-agent stop && \
650 service neutron-openvswitch-agent stop
651 """)
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300652 yield result
653 #
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300654 salt_actions.cmd_run("I@neutron:server", """
655 service neutron-dhcp-agent start && \
656 service neutron-l3-agent start && \
657 service neutron-metadata-agent start && \
658 service neutron-openvswitch-agent start
659 """)
660 # TODO: add check that all services are UP and running
661
662 @pytest.mark.grab_versions
663 @pytest.mark.parametrize("_", [settings.ENV_NAME])
664 @pytest.mark.run_mcp_update
665 def test_update_rabbit(self, salt_actions, reclass_actions,
666 drivetrain_actions, show_step, _,
667 disable_automatic_failover_neutron_for_test,
668 disable_neutron_agents_for_test):
669 """ Updates RabbitMQ
670 Scenario:
671 1. Include the RabbitMQ upgrade pipeline job to DriveTrain
672 2. Add repositories with new RabbitMQ packages
673 3. Start Deploy - upgrade RabbitMQ pipeline
674
675 Updating RabbitMq should be completed before the OpenStack updating
676 process starts
677 """
678 salt = salt_actions
679 reclass = reclass_actions
680 dt = drivetrain_actions
681
682 # ####### Include the RabbitMQ upgrade pipeline job to DriveTrain ####
683 show_step(1)
684 reclass.add_class(
685 "system.jenkins.client.job.deploy.update.upgrade_rabbitmq",
686 "cluster/*/cicd/control/leader.yml")
687 salt.enforce_state("I@jenkins:client", "jenkins.client")
688
689 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
690 "True",
691 "cluster/*/infra/init.yml")
692 salt.run_state("I@rabbitmq:server", "saltutil.refresh_pillar")
693
694 # ########### Add repositories with new RabbitMQ packages ############
695 show_step(2)
696 salt.enforce_state("I@rabbitmq:server", "linux.system.repo")
697
698 # ########### Start Deploy - upgrade RabbitMQ pipeline ############
699 show_step(3)
700 job_parameters = {
Hanna Arhipova874c68f2021-03-29 15:57:19 +0300701 'INTERACTIVE': 'false',
702 'OS_DIST_UPGRADE': 'true',
703 'OS_UPGRADE': 'true'
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300704 }
705
Hanna Arhipova508f6532021-01-27 15:52:45 +0200706 job_result, job_description = dt.start_job_on_jenkins(
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300707 job_name='deploy-upgrade-rabbitmq',
708 job_parameters=job_parameters,
PGlazov99364cb2021-09-20 12:36:18 +0400709 build_timeout=50 * 60
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300710 )
Hanna Arhipova508f6532021-01-27 15:52:45 +0200711 assert job_result == 'SUCCESS', job_description
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300712
713 @pytest.mark.grab_versions
714 @pytest.mark.parametrize("_", [settings.ENV_NAME])
715 @pytest.mark.run_mcp_update
PGlazov215a4572022-03-05 05:09:04 +0400716 def test_update_ceph(self, salt_actions, drivetrain_actions,
717 reclass_actions, show_step, _):
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300718 """ Updates Ceph to the latest minor version
719
720 Scenario:
721 1. Add workaround for unhealth Ceph
722 2. Start ceph-upgrade job with default parameters
723 3. Check Ceph version for all nodes
PGlazov215a4572022-03-05 05:09:04 +0400724 4. WA id_reclaim only for nautilus
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300725
726 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update/ceph-update.html
727 """
728 salt = salt_actions
PGlazov215a4572022-03-05 05:09:04 +0400729 reclass = reclass_actions
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300730 dt = drivetrain_actions
731
732 # ###################### Add workaround for unhealth Ceph ############
733 show_step(1)
734 salt.cmd_run("I@ceph:radosgw",
735 "ceph config set 'mon pg warn max object skew' 20")
736 # ###################### Start ceph-upgrade pipeline #################
737 show_step(2)
738 job_parameters = {}
739
Hanna Arhipova508f6532021-01-27 15:52:45 +0200740 job_result, job_description = dt.start_job_on_jenkins(
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300741 job_name='ceph-update',
742 job_parameters=job_parameters)
743
Hanna Arhipova508f6532021-01-27 15:52:45 +0200744 assert job_result == 'SUCCESS', job_description
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300745
746 # ########## Verify Ceph version #####################################
747 show_step(3)
748
749 ceph_version_by_nodes = salt.cmd_run(
Hanna Arhipova19429962019-10-17 15:16:49 +0300750 "I@ceph:* and not I@ceph:monitoring and not I@ceph:backup:server",
751 "ceph version")[0]
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300752
753 assert has_only_similar(ceph_version_by_nodes), ceph_version_by_nodes
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300754
PGlazov215a4572022-03-05 05:09:04 +0400755 # ########## WA id_reclaim only for nautilus #########################
756 show_step(4)
757
758 ceph_version = salt_actions.get_single_pillar(
759 "I@salt:master",
Pavel Glazov5093eaf2023-03-09 21:02:42 +0400760 "_param:ceph_version")
PGlazov215a4572022-03-05 05:09:04 +0400761 if ceph_version == "nautilus":
762 wa_cve_2021_20288_global_id_reclaim(reclass, salt)
763 else:
764 LOG.info("Skip WA for luminous")
765
Hanna Arhipovaac008562019-10-17 11:54:23 +0300766 @pytest.mark.grab_versions
767 @pytest.mark.parametrize("_", [settings.ENV_NAME])
768 @pytest.mark.run_mcp_update
769 def test_update_stacklight(self, _, drivetrain_actions):
770 """ Update packages for Stacklight
771 Scenario:
772 1. Start Deploy - upgrade Stacklight job
773 """
774 drivetrain = drivetrain_actions
775
776 job_parameters = {
777 "STAGE_UPGRADE_DOCKER_COMPONENTS": True,
778 "STAGE_UPGRADE_ES_KIBANA": True,
Hanna Arhipova874c68f2021-03-29 15:57:19 +0300779 "STAGE_UPGRADE_SYSTEM_PART": True,
780 'OS_DIST_UPGRADE': 'true',
781 'OS_UPGRADE': 'true'
Hanna Arhipovaac008562019-10-17 11:54:23 +0300782 }
Hanna Arhipova508f6532021-01-27 15:52:45 +0200783 job_result, job_description = drivetrain.start_job_on_jenkins(
Hanna Arhipovaac008562019-10-17 11:54:23 +0300784 job_name="stacklight-upgrade",
785 job_parameters=job_parameters)
786
Hanna Arhipova508f6532021-01-27 15:52:45 +0200787 assert job_result == 'SUCCESS', job_description
Hanna Arhipovaac008562019-10-17 11:54:23 +0300788
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300789
Hanna Arhipova19429962019-10-17 15:16:49 +0300790@pytest.mark.usefixtures("switch_to_proposed_pipelines",
791 "enable_openstack_update")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300792class TestOpenstackUpdate(object):
793
794 @pytest.mark.grab_versions
795 @pytest.mark.run_mcp_update
796 def test__pre_update__enable_pipeline_job(self,
797 reclass_actions, salt_actions,
798 show_step):
799 """ Enable pipeline in the Drivetrain
800
801 Scenario:
802 1. Add deploy.update.* classes to the reclass
803 2. Start jenkins.client salt state
804
805 """
806 salt = salt_actions
807 reclass = reclass_actions
808 show_step(1)
809 reclass.add_class("system.jenkins.client.job.deploy.update.upgrade",
810 "cluster/*/cicd/control/leader.yml")
811
812 reclass.add_class(
813 "system.jenkins.client.job.deploy.update.upgrade_ovs_gateway",
814 "cluster/*/cicd/control/leader.yml")
815
816 reclass.add_class(
817 "system.jenkins.client.job.deploy.update.upgrade_compute",
818 "cluster/*/cicd/control/leader.yml")
819
820 show_step(2)
821 r, errors = salt.enforce_state("I@jenkins:client", "jenkins.client")
822 assert errors is None
823
824 @pytest.mark.grab_versions
825 @pytest.mark.parametrize('target', get_control_plane_targets())
826 @pytest.mark.run_mcp_update
Hanna Arhipova19429962019-10-17 15:16:49 +0300827 def test__update__control_plane(self, drivetrain_actions, target):
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300828 """Start 'Deploy - upgrade control VMs' for specific node
829 """
830 job_parameters = {
831 "TARGET_SERVERS": target,
Hanna Arhipova606d5182019-12-13 13:23:55 +0200832 "OS_DIST_UPGRADE": True,
PGlazova5039252021-10-06 21:40:01 +0400833 "UPGRADE_SALTSTACK": True,
Hanna Arhipova606d5182019-12-13 13:23:55 +0200834 "OS_UPGRADE": True,
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300835 "INTERACTIVE": False}
Hanna Arhipova508f6532021-01-27 15:52:45 +0200836 job_result, job_description = drivetrain_actions.start_job_on_jenkins(
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300837 job_name="deploy-upgrade-control",
838 job_parameters=job_parameters)
839
Hanna Arhipova508f6532021-01-27 15:52:45 +0200840 assert job_result == 'SUCCESS', job_description
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300841
842 @pytest.mark.grab_versions
843 @pytest.mark.run_mcp_update
Hanna Arhipova606d5182019-12-13 13:23:55 +0200844 def test__update__data_plane(self, drivetrain_actions, salt_actions):
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300845 """Start 'Deploy - upgrade OVS gateway'
846 """
Hanna Arhipova606d5182019-12-13 13:23:55 +0200847 if not salt_actions.cmd_run("gtw*", "test.ping")[0].keys():
848 pytest.skip("This deployment doesn't have gtw* nodes")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300849 job_parameters = {
Hanna Arhipova606d5182019-12-13 13:23:55 +0200850 "OS_DIST_UPGRADE": True,
851 "OS_UPGRADE": True,
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300852 "INTERACTIVE": False}
Hanna Arhipova508f6532021-01-27 15:52:45 +0200853 job_result, job_description = drivetrain_actions.start_job_on_jenkins(
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300854 job_name="deploy-upgrade-ovs-gateway",
855 job_parameters=job_parameters)
856
Hanna Arhipova508f6532021-01-27 15:52:45 +0200857 assert job_result == 'SUCCESS', job_description
Hanna Arhipova19429962019-10-17 15:16:49 +0300858
859 @pytest.mark.grab_versions
860 @pytest.mark.run_mcp_update
861 def test__update__computes(self, drivetrain_actions):
862 """Start 'Deploy - upgrade computes'
863 """
864 job_parameters = {
Hanna Arhipova606d5182019-12-13 13:23:55 +0200865 "OS_DIST_UPGRADE": True,
866 "OS_UPGRADE": True,
Hanna Arhipova19429962019-10-17 15:16:49 +0300867 "INTERACTIVE": False}
Hanna Arhipova508f6532021-01-27 15:52:45 +0200868 job_result, job_description = drivetrain_actions.start_job_on_jenkins(
Hanna Arhipova19429962019-10-17 15:16:49 +0300869 job_name="deploy-upgrade-compute",
870 job_parameters=job_parameters)
871
Hanna Arhipova508f6532021-01-27 15:52:45 +0200872 assert job_result == 'SUCCESS', job_description