Add new test 'shutdown_non_primary_controller_ceph'

Scenario:
1. Pre-condition - do steps from 'deploy_ha_ceph' test
2. Create 1 instance
3. Set floating IP associated with created instance
4. Shut down non primary controller
5. Wait for HA services to be ready
6. Verify networks
7. Ensure connectivity to external resources from VM
8. Run OSTF tests

Related blueprint run-fuel-qa-on-baremetal

Change-Id: I55a8a9e908b52407d3892bba626883146404154a
This commit is contained in:
Oleksandr Ivashchenko 2016-08-31 10:54:57 +03:00
parent 56c543ff00
commit 3bf3cdd3eb
1 changed files with 97 additions and 0 deletions

View File

@ -253,3 +253,100 @@ class FailoverGroup2(TestBasic):
self.fuel_web.run_ostf(cluster_id)
self.env.make_snapshot('shutdown_primary_controller_ceph')
@test(depends_on_groups=['deploy_ha_ceph'],
groups=['shutdown_non_primary_controller_ceph'])
@log_snapshot_after_test
def shutdown_non_primary_controller_ceph(self):
"""Shutdown non primary controller for Neutron on ceph cluster
Scenario:
1. Pre-condition - do steps from 'deploy_ha_ceph' test
2. Create 1 instance
3. Set floating IP associated with created instance
4. Shut down non primary controller
5. Wait for HA services to be ready
6. Verify networks
7. Ensure connectivity to external resources from VM
8. Run OSTF tests
9. Turn on non-primary controller
10. Wait for for OS services to be ready
11. Wait for HA services to be ready
12. Verify networks
13. Run OSTF tests
Duration: 180 min
Snapshot: shutdown_non_primary_controller_ceph
"""
self.show_step(1)
self.env.revert_snapshot('deploy_ha_ceph')
cluster_id = self.fuel_web.get_last_created_cluster()
controllers = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
cluster_id, roles=('controller',))
self.show_step(2)
os = os_actions.OpenStackActions(
controller_ip=self.fuel_web.get_public_vip(cluster_id),
user='failover', passwd='failover', tenant='failover')
net_name = self.fuel_web.get_cluster_predefined_networks_name(
cluster_id)['private_net']
hypervisors = os.get_hypervisors()
hypervisor_name = hypervisors[0].hypervisor_hostname
instance_1 = os.create_server_for_migration(
neutron=True,
availability_zone="nova:{0}".format(hypervisor_name),
label=net_name
)
logger.info("New instance {0} created on {1}"
.format(instance_1.id, hypervisor_name))
self.show_step(3)
floating_ip_1 = os.assign_floating_ip(instance_1)
logger.info("Floating address {0} associated with instance {1}"
.format(floating_ip_1.ip, instance_1.id))
self.show_step(4)
primary_controller = self.fuel_web.get_nailgun_primary_node(
self.fuel_web.get_devops_node_by_nailgun_node(controllers[0]))
pn_controller = self.fuel_web.get_nailgun_node_by_devops_node(
primary_controller)
np_controllers = [c for c in controllers if
c['id'] != pn_controller['id']]
d_node = \
self.fuel_web.get_devops_node_by_nailgun_node(np_controllers[0])
self.fuel_web.warm_shutdown_nodes([d_node])
self.show_step(5)
self.fuel_web.assert_ha_services_ready(cluster_id, should_fail=1)
self.show_step(6)
self.fuel_web.verify_network(cluster_id)
self.show_step(7)
wait(lambda: tcp_ping(floating_ip_1.ip, 22), timeout=120,
timeout_msg='Can not ping instance'
' by floating ip {0}'.format(floating_ip_1.ip))
self.show_step(8)
self.fuel_web.run_ostf(cluster_id)
self.show_step(9)
self.fuel_web.warm_start_nodes([d_node])
self.show_step(10)
self.fuel_web.assert_os_services_ready(cluster_id, timeout=15 * 60)
self.show_step(11)
self.fuel_web.assert_ha_services_ready(cluster_id)
self.show_step(12)
self.fuel_web.verify_network(cluster_id)
self.show_step(13)
self.fuel_web.run_ostf(cluster_id)
self.env.make_snapshot('shutdown_primary_controller_ceph')