From 71abe120b45480ac04ec0f4adf685f9787bfc139 Mon Sep 17 00:00:00 2001 From: Dennis Dmitriev Date: Thu, 13 Aug 2015 19:05:22 +0300 Subject: [PATCH] Close remote connections after using checkers.check_public_ping() Change-Id: Ib24837db8c4cc2e7a90f4fbd1b4c6b950ecce5b4 Related-Bug:#1483756 --- fuelweb_test/helpers/checkers.py | 13 ++++++------- fuelweb_test/models/fuel_web_client.py | 8 ++++---- fuelweb_test/tests/test_ha_one_controller.py | 1 - fuelweb_test/tests/test_multiple_networks.py | 4 ++-- .../tests/tests_strength/test_failover_base.py | 9 +++------ fuelweb_test/tests/tests_strength/test_neutron.py | 12 +++++++----- 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/fuelweb_test/helpers/checkers.py b/fuelweb_test/helpers/checkers.py index 577b3f686..68b089b30 100644 --- a/fuelweb_test/helpers/checkers.py +++ b/fuelweb_test/helpers/checkers.py @@ -1017,17 +1017,16 @@ def check_repo_managment(remote): remote.check_call(cmd) -def check_public_ping(remotes): +def check_public_ping(remote): """ Check if ping public vip - :type remotes: list + :type remote: SSHClient object """ cmd = ('ruby /etc/puppet/modules/osnailyfacter/' 'modular/virtual_ips/public_vip_ping_post.rb') - for remote in remotes: - res = remote.execute(cmd) - assert_equal(0, res['exit_code'], - 'Public ping check failed:' - ' {0}'.format(res)) + res = remote.execute(cmd) + assert_equal(0, res['exit_code'], + 'Public ping check failed:' + ' {0}'.format(res)) def check_cobbler_node_exists(remote, node_id): diff --git a/fuelweb_test/models/fuel_web_client.py b/fuelweb_test/models/fuel_web_client.py index 0eaba4a15..bb701cc41 100644 --- a/fuelweb_test/models/fuel_web_client.py +++ b/fuelweb_test/models/fuel_web_client.py @@ -485,9 +485,9 @@ class FuelWebClient(object): if MULTIPLE_NETWORKS: node_groups = {n['name']: [] for n in NODEGROUPS} self.update_nodegroups(cluster_id, node_groups) - for NODEGROUP in NODEGROUPS: + for nodegroup in NODEGROUPS: self.update_network_configuration(cluster_id, - nodegroup=NODEGROUP) + nodegroup=nodegroup) else: self.update_network_configuration(cluster_id) @@ -1205,7 +1205,7 @@ class FuelWebClient(object): timeout=60 * 2) node = self.get_nailgun_node_by_devops_node(devops_node) assert_true(node['online'], - 'Node {} is online'.format(node['mac'])) + 'Node {0} is offline'.format(node['mac'])) if custom_names: name = custom_names.get(node_name, @@ -1213,7 +1213,7 @@ class FuelWebClient(object): node_name, "_".join(node_roles))) else: - name = '{}_{}'.format(node_name, "_".join(node_roles)) + name = '{0}_{1}'.format(node_name, "_".join(node_roles)) node_data = { 'cluster_id': cluster_id, diff --git a/fuelweb_test/tests/test_ha_one_controller.py b/fuelweb_test/tests/test_ha_one_controller.py index 4777fc769..408a369e2 100644 --- a/fuelweb_test/tests/test_ha_one_controller.py +++ b/fuelweb_test/tests/test_ha_one_controller.py @@ -19,7 +19,6 @@ from proboscis.asserts import assert_equal from proboscis.asserts import assert_true from proboscis import test -from fuelweb_test.helpers import checkers from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers.eb_tables import Ebtables from fuelweb_test.helpers import os_actions diff --git a/fuelweb_test/tests/test_multiple_networks.py b/fuelweb_test/tests/test_multiple_networks.py index 52e6b41fb..b8b7180bc 100644 --- a/fuelweb_test/tests/test_multiple_networks.py +++ b/fuelweb_test/tests/test_multiple_networks.py @@ -138,7 +138,7 @@ class TestMultipleClusterNets(TestBasic): 6. Run health checks (OSTF) Duration 110m - Snapshot deploy_neutron_tun_ha_nodegroups + Snapshot deploy_ceph_ha_nodegroups """ @@ -178,4 +178,4 @@ class TestMultipleClusterNets(TestBasic): self.fuel_web.deploy_cluster_wait(cluster_id, timeout=150 * 60) self.fuel_web.verify_network(cluster_id) self.fuel_web.run_ostf(cluster_id=cluster_id) - self.env.make_snapshot("deploy_neutron_tun_ha_nodegroups") + self.env.make_snapshot("deploy_ceph_ha_nodegroups") diff --git a/fuelweb_test/tests/tests_strength/test_failover_base.py b/fuelweb_test/tests/tests_strength/test_failover_base.py index 59b25a72a..c78680f4f 100644 --- a/fuelweb_test/tests/tests_strength/test_failover_base.py +++ b/fuelweb_test/tests/tests_strength/test_failover_base.py @@ -128,12 +128,9 @@ class TestHaFailoverBase(TestBasic): os_conn, smiles_count=16, networks_count=1, timeout=300) self.fuel_web.verify_network(cluster_id) - # Bug #1289297. Pause 5 min to make sure that all remain activity - # on the admin node has over before creating a snapshot. - time.sleep(5 * 60) - remotes = [self.fuel_web.get_ssh_for_node(node) for node - in ['slave-0{0}'.format(slave) for slave in xrange(1, 4)]] - check_public_ping(remotes) + for node in ['slave-0{0}'.format(slave) for slave in xrange(1, 4)]: + with self.fuel_web.get_ssh_for_node(node) as remote: + check_public_ping(remote) self.env.make_snapshot(self.snapshot_name, is_make=True) diff --git a/fuelweb_test/tests/tests_strength/test_neutron.py b/fuelweb_test/tests/tests_strength/test_neutron.py index d1c9d5f4d..8b7310958 100644 --- a/fuelweb_test/tests/tests_strength/test_neutron.py +++ b/fuelweb_test/tests/tests_strength/test_neutron.py @@ -87,10 +87,10 @@ class TestNeutronFailover(base_test_case.TestBasic): groups=["deploy_ha_neutron"]) @log_snapshot_after_test def deploy_ha_neutron(self): - """Deploy cluster in HA mode, Neutron with GRE segmentation + """Deploy cluster in HA mode, Neutron with VXLAN segmentation Scenario: - 1. Create cluster. HA, Neutron with GRE segmentation + 1. Create cluster. HA, Neutron with VXLAN segmentation 2. Add 3 nodes with controller roles 3. Add 2 nodes with compute roles 4. Add 1 node with cinder role @@ -128,9 +128,11 @@ class TestNeutronFailover(base_test_case.TestBasic): } ) self.fuel_web.deploy_cluster_wait(cluster_id) - remotes = [self.fuel_web.get_ssh_for_node(node) for node - in ['slave-0{0}'.format(slave) for slave in xrange(1, 4)]] - checkers.check_public_ping(remotes) + + for node in ['slave-0{0}'.format(slave) for slave in xrange(1, 4)]: + with self.fuel_web.get_ssh_for_node(node) as remote: + checkers.check_public_ping(remote) + self.env.make_snapshot("deploy_ha_neutron", is_make=True) @test(depends_on=[deploy_ha_neutron],