HA node reboot test cases for ovs virt env
test_restart_ctl_with_vip
test_restart_mon_with_vip
Related: PROD-16560
Change-Id: Ib55a6f7dea34f0923e01f6a01775f08fa2f9f127
diff --git a/tcp_tests/tests/system/test_failover.py b/tcp_tests/tests/system/test_failover.py
index 2f74a26..615e26f 100644
--- a/tcp_tests/tests/system/test_failover.py
+++ b/tcp_tests/tests/system/test_failover.py
@@ -170,7 +170,7 @@
4. Check targets before restart
5. Restart mon01
6. Check targets after restart
- 6. Run LMA smoke after failover
+ 7. Run LMA smoke after failover
"""
@@ -526,3 +526,78 @@
assert 'passed' in test['outcome'], \
'Failed test {}'.format(test)
LOG.info("*************** DONE **************")
+
+ @pytest.mark.grab_versions
+ @pytest.mark.fail_snapshot
+ @pytest.mark.revert_snapshot(ext.SNAPSHOT.sl_deployed)
+ def test_restart_mon_with_vip(self, sl_os_deployed,
+ openstack_actions, salt_actions,
+ common_services_actions, show_step):
+ """Test restart mon with VIP
+
+ Scenario:
+ 1. Prepare salt on hosts
+ 2. Setup controller nodes
+ 3. Setup compute and monitoring nodes
+ 4. Check LMA before mon node restart
+ 5. Find mon minion id with VIP
+ 6. Restart mon minion id with VIP
+ 7. Check that VIP was actually migrated on a new node
+ 8. Run tempest smoke after failover
+
+
+ """
+ # TR case #4753939
+ common_services_actions.check_keepalived_pillar()
+ salt = salt_actions
+
+ # STEP #1,2,3
+ show_step(1)
+ show_step(2)
+ show_step(3)
+
+ # STEP #4
+ show_step(4)
+ mon_nodes = sl_os_deployed.get_monitoring_nodes()
+ LOG.debug('Mon nodes list {0}'.format(mon_nodes))
+ before_result = sl_os_deployed.run_sl_tests_json(
+ 'cfg01', '/root/stacklight-pytest/stacklight_tests/',
+ 'tests/prometheus/', 'test_alerts.py')
+ failed_tests = [test['name'] for test in
+ before_result if 'passed' not in test['outcome']]
+
+ # STEP #5
+ show_step(5)
+ mon_vip_pillar = salt.get_pillar(
+ tgt="mon0*",
+ pillar="_param:cluster_vip_address")[0]
+ vip = [vip for minion_id, vip in mon_vip_pillar.items()][0]
+ minion_vip = common_services_actions.get_keepalived_vip_minion_id(vip)
+ LOG.info("VIP {0} is on {1}".format(vip, minion_vip))
+
+ # STEP #6
+ show_step(6)
+ openstack_actions.warm_restart_nodes(minion_vip)
+
+ # STEP #7
+ show_step(7)
+ # Check that VIP has been actually migrated to a new node
+ new_minion_vip = common_services_actions.get_keepalived_vip_minion_id(
+ vip)
+ LOG.info("Migrated VIP {0} is on {1}".format(vip, new_minion_vip))
+ assert new_minion_vip != minion_vip, (
+ "VIP {0} wasn't migrated from {1} after node reboot!"
+ .format(vip, new_minion_vip))
+ common_services_actions.check_keepalived_pillar()
+
+ # STEP #8
+ show_step(8)
+ # Run SL component tetsts
+ after_result = sl_os_deployed.run_sl_tests_json(
+ 'cfg01', '/root/stacklight-pytest/stacklight_tests/',
+ 'tests/prometheus/', 'test_alerts.py')
+ for test in after_result:
+ if test['name'] not in failed_tests:
+ assert 'passed' in test['outcome'], \
+ 'Failed test {}'.format(test)
+ LOG.info("*************** DONE **************")