Add scenario for automatic Galera upgrade
Change-Id: I080f169292d62f12bb3fa7496e3644a655ffe131
diff --git a/tcp_tests/tests/system/conftest.py b/tcp_tests/tests/system/conftest.py
index 0bd4232..0627ede 100644
--- a/tcp_tests/tests/system/conftest.py
+++ b/tcp_tests/tests/system/conftest.py
@@ -28,6 +28,7 @@
from tcp_tests.fixtures.drivetrain_fixtures import * # noqa
from tcp_tests.fixtures.day1_fixtures import * # noqa
from tcp_tests.fixtures.runtest_fixtures import * # noqa
+from tcp_tests.fixtures.reclass_fixtures import * # noqa
__all__ = sorted([ # sort for documentation
diff --git a/tcp_tests/tests/system/test_update.py b/tcp_tests/tests/system/test_update.py
index 3db5a74..4ec04b0 100644
--- a/tcp_tests/tests/system/test_update.py
+++ b/tcp_tests/tests/system/test_update.py
@@ -11,7 +11,7 @@
class TestUpdateMcpCluster(object):
"""
Following the steps in
- https://docs.mirantis.com/mcp/q4-18/mcp-operations-guide/update-upgrade/minor-update.html#minor-update
+ https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update.html#minor-update
"""
@pytest.mark.grab_versions
@@ -134,6 +134,76 @@
assert update_drivetrain == 'SUCCESS', "{0}\n{1}".format(
description, '\n'.join(stages))
+ @pytest.mark.grab_versions
+ @pytest.mark.parametrize("_", [settings.ENV_NAME])
@pytest.mark.run_mcp_update
- def test_update_gluster(self):
- pass
+ def test_update_galera(self, salt_actions, reclass_actions, show_step, _):
+ """ Upgrade Galera automatically
+
+ Scenario:
+ 1. Include the Galera upgrade pipeline job to DriveTrain
+ 2. Apply the jenkins.client state on the Jenkins nodes
+ 3. set the openstack_upgrade_enabled parameter to true
+ 4. Refresh pillars
+ 5. Add repositories with new Galera packages
+ 6. Start job from Jenkins
+ """
+ salt = salt_actions
+ reclass = reclass_actions
+ # ################### Enable pipeline #################################
+ show_step(1)
+ reclass.add_class(
+ "system.jenkins.client.job.deploy.update.upgrade_galera",
+ "cluster/*/cicd/control/leader.yml")
+ show_step(2)
+ salt.enforce_state("I@jenkins:client", "jenkins.client")
+
+ # ############### Enable automatic upgrade ############################
+ show_step(3)
+ reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
+ "True",
+ "cluster/*/infra/init.yml")
+
+ show_step(4)
+ salt.enforce_state("dbs*", "saltutil.refresh_pillar")
+
+ # ############# Add repositories with new Galera packages #######
+ show_step(5)
+ salt.enforce_state("dbs*", "linux.system.repo")
+ salt.enforce_state("cfg*", "salt.master")
+
+ jenkins_creds = salt.get_cluster_jenkins_creds()
+
+ # #################### Login Jenkins on cid01 node ###################
+ show_step(6)
+
+ jenkins_url = jenkins_creds.get('url')
+ jenkins_user = jenkins_creds.get('user')
+ jenkins_pass = jenkins_creds.get('pass')
+ jenkins_build_timeout = 40*60
+ job_name = 'deploy-upgrade-galera'
+ job_parameters = {
+ 'INTERACTIVE': 'false'
+ }
+
+ update_galera = run_jenkins_job.run_job(
+ host=jenkins_url,
+ username=jenkins_user,
+ password=jenkins_pass,
+ build_timeout=jenkins_build_timeout,
+ verbose=False,
+ job_name=job_name,
+ job_parameters=job_parameters)
+
+ (description, stages) = get_jenkins_job_stages.get_deployment_result(
+ host=jenkins_url,
+ username=jenkins_user,
+ password=jenkins_pass,
+ job_name=job_name,
+ build_number='lastBuild')
+
+ LOG.info(description)
+ LOG.info('\n'.join(stages))
+
+ assert update_galera == 'SUCCESS', "{0}\n{1}".format(
+ description, '\n'.join(stages))