Merge "Add test_k8s_cicd_upgrade test and fix grap/grab typos"
diff --git a/tcp_tests/tests/system/test_failover_k8s.py b/tcp_tests/tests/system/test_failover_k8s.py
index a334a42..b872c36 100644
--- a/tcp_tests/tests/system/test_failover_k8s.py
+++ b/tcp_tests/tests/system/test_failover_k8s.py
@@ -21,7 +21,7 @@
class TestFailoverK8s(object):
- @pytest.mark.grap_versions
+ @pytest.mark.grab_versions
@pytest.mark.fail_snapshot
def test_k8s_master_vip_migration(self, show_step, k8s_deployed, underlay,
k8s_actions, core_actions,
diff --git a/tcp_tests/tests/system/test_k8s_actions.py b/tcp_tests/tests/system/test_k8s_actions.py
index 612367c..066a476 100644
--- a/tcp_tests/tests/system/test_k8s_actions.py
+++ b/tcp_tests/tests/system/test_k8s_actions.py
@@ -22,6 +22,7 @@
from tcp_tests import settings
from tcp_tests.managers.k8s import read_yaml_file
+from tcp_tests.managers.jenkins.client import JenkinsClient
LOG = logger.logger
@@ -94,7 +95,7 @@
show_step(1)
k8s_deployed.start_k8s_cncf_verification()
- @pytest.mark.grap_versions
+ @pytest.mark.grab_versions
@pytest.mark.fail_snapshot
def test_k8s_chain_update(self, show_step, underlay, config, k8s_deployed,
k8s_chain_update_log_helper):
@@ -141,7 +142,7 @@
show_step(8)
sample.delete()
- @pytest.mark.grap_versions
+ @pytest.mark.grab_versions
@pytest.mark.fail_snapshot
def test_k8s_metallb(self, show_step, config, k8s_deployed):
"""Enable metallb in cluster and do basic tests
@@ -195,7 +196,7 @@
for sample in samples:
sample.delete()
- @pytest.mark.grap_versions
+ @pytest.mark.grab_versions
@pytest.mark.fail_snapshot
@pytest.mark.k8s_genie
def test_k8s_genie_flannel(self, show_step, config,
@@ -314,7 +315,7 @@
multicni_pod.delete()
nocni_pod.delete()
- @pytest.mark.grap_versions
+ @pytest.mark.grab_versions
@pytest.mark.fail_snapshot
def test_k8s_dashboard(self, show_step, config,
salt_deployed, k8s_deployed):
@@ -389,7 +390,7 @@
for namespace in dashboard_namespaces:
assert namespace['objectMeta']['name'] in namespaces_names_list
- @pytest.mark.grap_versions
+ @pytest.mark.grab_versions
@pytest.mark.fail_snapshot
def test_k8s_ingress_nginx(self, show_step, config,
salt_deployed, k8s_deployed):
@@ -459,3 +460,41 @@
req2 = requests.get(ingress_address + "/test2", verify=False)
assert req2.status_code == 200
assert 'dep-ingress-2' in req2.text
+
+ @pytest.mark.grab_versions
+ @pytest.mark.fail_snapshot
+ def test_k8s_cicd_upgrade(self, show_step, config,
+ salt_deployed, k8s_deployed):
+ """Test k8s upgrade cicd pipeline
+
+ Scenario:
+ 1. Setup Kubernetes+CICD cluster
+ 2. Start deploy-k8s-upgrade job in jenkins
+ 3. Wait for job to end
+ """
+ show_step(1)
+ jenkins_info = salt_deployed.get_pillar(
+ tgt='cid*1*', pillar="jenkins:client:master")[0].values()[0]
+
+ salt_api = salt_deployed.get_pillar(
+ tgt='cid*1*', pillar="_param:jenkins_salt_api_url")[0].values()[0]
+
+ show_step(2)
+ jenkins = JenkinsClient(
+ host='http://{host}:{port}'.format(**jenkins_info),
+ username=jenkins_info['username'],
+ password=jenkins_info['password'])
+
+ params = jenkins.make_defults_params('deploy-k8s-upgrade')
+ params['SALT_MASTER_URL'] = salt_api
+ params['SALT_MASTER_CREDENTIALS'] = 'salt'
+ params['CONFORMANCE_RUN_AFTER'] = True
+ params['CONFORMANCE_RUN_BEFORE'] = True
+ build = jenkins.run_build('deploy-k8s-upgrade', params)
+
+ show_step(3)
+ jenkins.wait_end_of_build(
+ name=build[0], build_id=build[1], timeout=3600 * 4)
+ result = jenkins.build_info(
+ name=build[0], build_id=build[1])['result']
+ assert result == 'SUCCESS', "k8s upgrade job has been failed"