From 5a6c1c86cd071f4b2700ba8e717368c57c16c4cb Mon Sep 17 00:00:00 2001 From: vgorin Date: Wed, 24 Feb 2016 20:42:56 +0300 Subject: [PATCH] Refactoring functions in checkers.py(part 2) Following functions were changed: * get_ceph_partitions * get_mongo_partitions * check_ceph_image_size * check_cinder_image_size * upload_tarball_path * install_plugin_check_code Folowing functions were moved to utils.py: * get_mongo_partitions * get_ceph_partitions * install_plugin_check_code * upload_tarball_path Related tests are also modified. Implements: blueprint sshmanager-integration Change-Id: I2c2bbe0ad0cabb815ee67c5ad89fe2142d2d7383 --- fuelweb_test/helpers/checkers.py | 72 +----- fuelweb_test/helpers/utils.py | 71 ++++++ .../test_fuel_plugin_contrail.py | 14 +- .../test_plugin_elasticsearch.py | 21 +- .../plugins/plugin_emc/test_plugin_emc.py | 20 +- .../test_fuel_plugin_example.py | 70 +++--- .../plugin_glusterfs/test_plugin_glusterfs.py | 36 +-- .../plugin_influxdb/test_plugin_influxdb.py | 14 +- .../plugins/plugin_lbaas/test_plugin_lbaas.py | 36 +-- .../test_plugin_lma_collector.py | 62 ++--- .../test_plugin_lma_infra_alerting.py | 22 +- .../plugin_reboot/test_plugin_reboot_task.py | 106 +++++---- .../test_plugin_vip_reservation.py | 217 +++++++++--------- .../plugin_zabbix/test_plugin_zabbix.py | 83 +++---- fuelweb_test/tests/test_ceph.py | 22 +- fuelweb_test/tests/test_services.py | 4 +- .../tests_neutron_tun/test_ha_tun_group_3.py | 14 +- .../test_ha_vlan_group_1.py | 12 +- .../test_ha_vlan_group_4.py | 11 +- .../test_ha_vlan_group_5.py | 12 +- .../test_ha_vlan_group_6.py | 12 +- .../test_ha_vlan_group_7.py | 6 +- .../tests_multirole/test_multirole_group_1.py | 6 +- .../test_separate_db.py | 22 +- .../test_separate_db_ceph.py | 23 +- .../test_separate_horizon.py | 23 +- .../test_separate_keystone.py | 37 +-- .../test_separate_keystone_ceph.py | 38 +-- .../test_separate_multiroles.py | 53 ++--- .../test_separate_rabbitmq.py | 22 +- .../test_separate_rabbitmq_ceph.py | 23 +- system_test/actions/plugins_actions.py | 18 +- 32 files changed, 605 insertions(+), 597 deletions(-) diff --git a/fuelweb_test/helpers/checkers.py b/fuelweb_test/helpers/checkers.py index 49a5f1e4d..1209e25b0 100644 --- a/fuelweb_test/helpers/checkers.py +++ b/fuelweb_test/helpers/checkers.py @@ -28,6 +28,7 @@ from fuelweb_test import logwrap from fuelweb_test.helpers.ssh_manager import SSHManager from fuelweb_test.helpers.utils import run_on_remote from fuelweb_test.helpers.utils import run_on_remote_get_results +from fuelweb_test.helpers.utils import get_mongo_partitions from fuelweb_test.settings import MASTER_IS_CENTOS7 from fuelweb_test.settings import EXTERNAL_DNS from fuelweb_test.settings import EXTERNAL_NTP @@ -151,42 +152,18 @@ def verify_network_list_api(os_conn, net_count=None): @logwrap -def get_ceph_partitions(remote, device, type="xfs"): - ret = remote.check_call("parted {device} print | grep {type}".format( - device=device, type=type))['stdout'] - if not ret: - logger.error("Partition not present! {partitions}: ".format( - remote.check_call("parted {device} print"))) - raise Exception - logger.debug("Partitions: {part}".format(part=ret)) - return ret - - -@logwrap -def get_mongo_partitions(remote, device): - ret = remote.check_call("lsblk | grep {device} | awk {size}".format( - device=device, - size=re.escape('{print $4}')))['stdout'] - if not ret: - logger.error("Partition not present! {partitions}: ".format( - remote.check_call("parted {device} print"))) - raise Exception - logger.debug("Partitions: {part}".format(part=ret)) - return ret - - -@logwrap -def check_ceph_image_size(remote, expected_size, device='vdc'): - ret = remote.check_call("df -m /dev/{device}* | grep ceph |" - " awk" - " {size}".format(device=device, - size=re.escape('{print $2}') - ))['stdout'] +def check_ceph_image_size(ip, expected_size, device='vdc'): + ret = ssh_manager.check_call( + ip=ip, + cmd="df -m /dev/{device}* | grep ceph | awk" + " {size}".format(device=device, + size=re.escape('{print $2}')) + )['stdout'] if not ret: logger.error("Partition not present! {}: ".format( - remote.check_call("df -m"))) - raise Exception + ssh_manager.check_call(ip=ip, cmd="df -m"))) + raise Exception() logger.debug("Partitions: {part}".format(part=ret)) assert_true(abs(float(ret[0].rstrip()) / float(expected_size) - 1) < 0.1, "size {0} is not equal" @@ -195,8 +172,8 @@ def check_ceph_image_size(remote, expected_size, device='vdc'): @logwrap -def check_cinder_image_size(remote, expected_size, device='vdc3'): - ret = get_mongo_partitions(remote, device)[0].rstrip().rstrip('G') +def check_cinder_image_size(ip, expected_size, device='vdc3'): + ret = get_mongo_partitions(ip, device)[0].rstrip().rstrip('G') cinder_size = float(ret) * 1024 assert_true(abs(cinder_size / float(expected_size) - 1) < 0.1, "size {0} is not equal" @@ -225,20 +202,6 @@ def check_unallocated_space(disks, contr_img_ceph=False): return True -@logwrap -def upload_tarball(node_ssh, tar_path, tar_target): - assert_true(tar_path, "Source path for uploading 'tar_path' is empty, " - "please check test settings!") - check_archive_type(tar_path) - try: - logger.info("Start to upload tar file") - node_ssh.upload(tar_path, tar_target) - logger.info('File {} was uploaded on master'.format(tar_path)) - except Exception: - logger.error('Failed to upload file') - logger.error(traceback.format_exc()) - - @logwrap def check_archive_type(tar_path): if os.path.splitext(tar_path)[1] not in [".tar", ".lrz", ".fp", ".rpm"]: @@ -384,17 +347,6 @@ def check_mysql(remote, node_name): raise -@logwrap -def install_plugin_check_code( - remote, plugin, exit_code=0): - cmd = "cd /var && fuel plugins --install {0} ".format(plugin) - chan, stdin, stderr, stdout = remote.execute_async(cmd) - logger.debug('Try to read status code from chain...') - assert_equal( - chan.recv_exit_status(), exit_code, - 'Install script fails with next message {0}'.format(''.join(stderr))) - - @logwrap def check_action_logs(scenario, postgres_actions): def _check(_action, _group=False): diff --git a/fuelweb_test/helpers/utils.py b/fuelweb_test/helpers/utils.py index 0412d02a5..05e28437a 100644 --- a/fuelweb_test/helpers/utils.py +++ b/fuelweb_test/helpers/utils.py @@ -26,6 +26,8 @@ import signal import ipaddr from proboscis import asserts +from proboscis.asserts import assert_true +from proboscis.asserts import assert_equal from fuelweb_test import logger from fuelweb_test import logwrap @@ -905,3 +907,72 @@ def fill_space(ip, file_dir, size): ip=ip, cmd='fallocate -l {0}G {1}'.format(size, file_path), err_msg="The file {0} was not allocated".format(file_name)) + + +@logwrap +def get_ceph_partitions(ip, device, type="xfs"): + # Moved from checkers.py for improvement of code + ret = SSHManager().check_call( + ip=ip, + cmd="parted {device} print | grep {type}".format(device=device, + type=type) + )['stdout'] + if not ret: + logger.error("Partition not present! {partitions}: ".format( + SSHManager().check_call(ip=ip, + cmd="parted {device} print"))) + raise Exception() + logger.debug("Partitions: {part}".format(part=ret)) + return ret + + +@logwrap +def get_mongo_partitions(ip, device): + # Moved from checkers.py for improvement of code + ret = SSHManager().check_call( + ip=ip, + cmd="lsblk | grep {device} | awk {size}".format( + device=device, + size=re.escape('{print $4}')) + )['stdout'] + if not ret: + logger.error("Partition not present! {partitions}: ".format( + SSHManager().check_call(ip=ip, + cmd="parted {device} print"))) + raise Exception() + logger.debug("Partitions: {part}".format(part=ret)) + return ret + + +@logwrap +def upload_tarball(ip, tar_path, tar_target): + # Moved from checkers.py for improvement of code + assert_true(tar_path, "Source path for uploading 'tar_path' is empty, " + "please check test settings!") + if os.path.splitext(tar_path)[1] not in [".tar", ".lrz", ".fp", ".rpm"]: + raise Exception("Wrong archive type!") + try: + logger.info("Start to upload tar file") + SSHManager().upload_to_remote( + ip=ip, + source=tar_path, + target=tar_target + ) + logger.info('File {} was uploaded on master'.format(tar_path)) + except Exception: + logger.error('Failed to upload file') + logger.error(traceback.format_exc()) + + +@logwrap +def install_plugin_check_code(ip, plugin, exit_code=0): + # Moved from checkers.py for improvement of code + cmd = "cd /var && fuel plugins --install {0} ".format(plugin) + chan, stdin, stderr, stdout = SSHManager().execute_async_on_remote( + ip=ip, + cmd=cmd + ) + logger.debug('Try to read status code from chain...') + assert_equal( + chan.recv_exit_status(), exit_code, + 'Install script fails with next message {0}'.format(''.join(stderr))) diff --git a/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py b/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py index b05ce94dc..c6c77cffe 100644 --- a/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py +++ b/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py @@ -20,7 +20,7 @@ from proboscis import test from proboscis.asserts import assert_true from fuelweb_test.helpers.decorators import log_snapshot_after_test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.common import Common from fuelweb_test import logger from fuelweb_test.settings import DEPLOYMENT_MODE @@ -89,13 +89,15 @@ class ContrailPlugin(TestBasic): with self.env.d_env.get_admin_remote() as remote: # copy plugin to the master node - checkers.upload_tarball( - remote, - CONTRAIL_PLUGIN_PATH, '/var') + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=CONTRAIL_PLUGIN_PATH, + tar_target='/var' + ) # install plugin - checkers.install_plugin_check_code( - remote, + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, plugin=os.path.basename(CONTRAIL_PLUGIN_PATH)) # copy additional packages to the master node diff --git a/fuelweb_test/tests/plugins/plugin_elasticsearch/test_plugin_elasticsearch.py b/fuelweb_test/tests/plugins/plugin_elasticsearch/test_plugin_elasticsearch.py index bbf881c52..829f991dd 100644 --- a/fuelweb_test/tests/plugins/plugin_elasticsearch/test_plugin_elasticsearch.py +++ b/fuelweb_test/tests/plugins/plugin_elasticsearch/test_plugin_elasticsearch.py @@ -20,7 +20,7 @@ from proboscis import test from fuelweb_test import logger from fuelweb_test.helpers.decorators import log_snapshot_after_test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.settings import DEPLOYMENT_MODE from fuelweb_test.settings import ELASTICSEARCH_KIBANA_PLUGIN_PATH from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -63,16 +63,17 @@ class TestElasticsearchPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as remote: - # copy plugin to the master node - checkers.upload_tarball( - remote, - ELASTICSEARCH_KIBANA_PLUGIN_PATH, '/var') + # copy plugin to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=ELASTICSEARCH_KIBANA_PLUGIN_PATH, + tar_target='/var' + ) - # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(ELASTICSEARCH_KIBANA_PLUGIN_PATH)) + # install plugin + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(ELASTICSEARCH_KIBANA_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_emc/test_plugin_emc.py b/fuelweb_test/tests/plugins/plugin_emc/test_plugin_emc.py index 52dda694f..10e253ee5 100644 --- a/fuelweb_test/tests/plugins/plugin_emc/test_plugin_emc.py +++ b/fuelweb_test/tests/plugins/plugin_emc/test_plugin_emc.py @@ -19,6 +19,7 @@ from proboscis import asserts from proboscis import test from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -104,16 +105,17 @@ class EMCPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_5_slaves") - with self.env.d_env.get_admin_remote() as remote: - # copy plugin to the master node - checkers.upload_tarball( - remote, - settings.EMC_PLUGIN_PATH, '/var') + # copy plugin to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.EMC_PLUGIN_PATH, + tar_target='/var' + ) - # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(settings.EMC_PLUGIN_PATH)) + # install plugin + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.EMC_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_example/test_fuel_plugin_example.py b/fuelweb_test/tests/plugins/plugin_example/test_fuel_plugin_example.py index 60b15b22f..a60d98ddc 100644 --- a/fuelweb_test/tests/plugins/plugin_example/test_fuel_plugin_example.py +++ b/fuelweb_test/tests/plugins/plugin_example/test_fuel_plugin_example.py @@ -19,6 +19,7 @@ from proboscis import test from fuelweb_test import logger from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.settings import DEPLOYMENT_MODE from fuelweb_test.settings import EXAMPLE_PLUGIN_PATH from fuelweb_test.settings import EXAMPLE_PLUGIN_V3_PATH @@ -56,16 +57,16 @@ class ExamplePlugin(TestBasic): # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) - with self.env.d_env.get_admin_remote() as remote: - checkers.upload_tarball( - remote, - EXAMPLE_PLUGIN_PATH, '/var') + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=EXAMPLE_PLUGIN_PATH, + tar_target='/var') - # install plugin + # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) segment_type = NEUTRON_SEGMENT['vlan'] cluster_id = self.fuel_web.create_cluster( @@ -141,17 +142,17 @@ class ExamplePlugin(TestBasic): """ self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as admin_remote: - # copy plugin to the master node - checkers.check_archive_type(EXAMPLE_PLUGIN_V3_PATH) - checkers.upload_tarball( - admin_remote, - EXAMPLE_PLUGIN_V3_PATH, - '/var') - # install plugin - checkers.install_plugin_check_code( - admin_remote, - plugin=os.path.basename(EXAMPLE_PLUGIN_V3_PATH)) + # copy plugin to the master node + checkers.check_archive_type(EXAMPLE_PLUGIN_V3_PATH) + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=EXAMPLE_PLUGIN_V3_PATH, + tar_target='/var' + ) + # install plugin + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(EXAMPLE_PLUGIN_V3_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -273,15 +274,17 @@ class ExamplePlugin(TestBasic): # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) - with self.env.d_env.get_admin_remote() as remote: - checkers.upload_tarball( - remote, EXAMPLE_PLUGIN_PATH, '/var') + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=EXAMPLE_PLUGIN_PATH, + tar_target='/var' + ) - # install plugin + # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -362,15 +365,16 @@ class ExamplePlugin(TestBasic): # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) - with self.env.d_env.get_admin_remote() as remote: - checkers.upload_tarball( - remote, EXAMPLE_PLUGIN_PATH, '/var') + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=EXAMPLE_PLUGIN_PATH, + tar_target='/var') - # install plugin + # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_glusterfs/test_plugin_glusterfs.py b/fuelweb_test/tests/plugins/plugin_glusterfs/test_plugin_glusterfs.py index f3c4808a8..c1bb07fe6 100644 --- a/fuelweb_test/tests/plugins/plugin_glusterfs/test_plugin_glusterfs.py +++ b/fuelweb_test/tests/plugins/plugin_glusterfs/test_plugin_glusterfs.py @@ -18,7 +18,7 @@ from proboscis.asserts import assert_true from proboscis import test from fuelweb_test.helpers.decorators import log_snapshot_after_test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.settings import DEPLOYMENT_MODE from fuelweb_test.settings import GLUSTER_CLUSTER_ENDPOINT from fuelweb_test.settings import GLUSTER_PLUGIN_PATH @@ -65,15 +65,16 @@ class GlusterfsPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as remote: - # copy plugin to the master node - checkers.upload_tarball( - remote, GLUSTER_PLUGIN_PATH, '/var') + # copy plugin to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=GLUSTER_PLUGIN_PATH, + tar_target='/var') - # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(GLUSTER_PLUGIN_PATH)) + # install plugin + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(GLUSTER_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -142,16 +143,17 @@ class GlusterfsPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_5_slaves") - with self.env.d_env.get_admin_remote() as remote: - # copy plugin to the master node - checkers.upload_tarball( - remote, GLUSTER_PLUGIN_PATH, '/var') + # copy plugin to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=GLUSTER_PLUGIN_PATH, + tar_target='/var') - # install plugin + # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(GLUSTER_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(GLUSTER_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_influxdb/test_plugin_influxdb.py b/fuelweb_test/tests/plugins/plugin_influxdb/test_plugin_influxdb.py index 34d6dfcd2..25ee5f1f5 100644 --- a/fuelweb_test/tests/plugins/plugin_influxdb/test_plugin_influxdb.py +++ b/fuelweb_test/tests/plugins/plugin_influxdb/test_plugin_influxdb.py @@ -20,7 +20,7 @@ from proboscis import test from fuelweb_test import logger from fuelweb_test.helpers.decorators import log_snapshot_after_test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.settings import DEPLOYMENT_MODE from fuelweb_test.settings import INFLUXDB_GRAFANA_PLUGIN_PATH from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -56,11 +56,13 @@ class TestInfluxdbPlugin(TestBasic): self.env.revert_snapshot("ready_with_3_slaves") # copy plugin to the master node and install it - with self.env.d_env.get_admin_remote() as remote: - checkers.upload_tarball( - remote, INFLUXDB_GRAFANA_PLUGIN_PATH, '/var') - checkers.install_plugin_check_code( - remote, plugin=os.path.basename(INFLUXDB_GRAFANA_PLUGIN_PATH)) + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=INFLUXDB_GRAFANA_PLUGIN_PATH, + tar_target='/var') + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(INFLUXDB_GRAFANA_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_lbaas/test_plugin_lbaas.py b/fuelweb_test/tests/plugins/plugin_lbaas/test_plugin_lbaas.py index ad00351b2..6590eef22 100644 --- a/fuelweb_test/tests/plugins/plugin_lbaas/test_plugin_lbaas.py +++ b/fuelweb_test/tests/plugins/plugin_lbaas/test_plugin_lbaas.py @@ -20,7 +20,7 @@ from proboscis import test from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers import os_actions -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test import logger from fuelweb_test.settings import DEPLOYMENT_MODE_SIMPLE from fuelweb_test.settings import LBAAS_PLUGIN_PATH @@ -112,16 +112,17 @@ class LbaasPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as remote: - # copy plugin to the master node - checkers.upload_tarball( - remote, LBAAS_PLUGIN_PATH, '/var') + # copy plugin to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=LBAAS_PLUGIN_PATH, + tar_target='/var') - # install plugin + # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(LBAAS_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(LBAAS_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -193,15 +194,16 @@ class LbaasPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as remote: - # copy plugin to the master node - checkers.upload_tarball( - remote, LBAAS_PLUGIN_PATH, '/var') + # copy plugin to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=LBAAS_PLUGIN_PATH, + tar_target='/var') - # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(LBAAS_PLUGIN_PATH)) + # install plugin + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(LBAAS_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py b/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py index 4b95b27e6..bfae06478 100644 --- a/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py +++ b/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py @@ -21,7 +21,7 @@ import requests from fuelweb_test import logger from fuelweb_test import settings -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.tests.base_test_case import SetupEnvironment from fuelweb_test.tests.base_test_case import TestBasic @@ -65,37 +65,37 @@ class TestLmaCollectorPlugin(TestBasic): # TODO(scroiset): use actions fuel_actions.py # upload_plugin and install_plugin - with self.env.d_env.get_admin_remote() as remote: - # copy plugins to the master node - checkers.upload_tarball( - remote, - settings.LMA_COLLECTOR_PLUGIN_PATH, "/var") - checkers.upload_tarball( - remote, - settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH, "/var") - checkers.upload_tarball( - remote, - settings.INFLUXDB_GRAFANA_PLUGIN_PATH, "/var") - checkers.upload_tarball( - remote, - settings.LMA_INFRA_ALERTING_PLUGIN_PATH, "/var") + # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.LMA_COLLECTOR_PLUGIN_PATH, + tar_target="/var") + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH, + tar_target="/var") + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.INFLUXDB_GRAFANA_PLUGIN_PATH, + tar_target="/var") + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.LMA_INFRA_ALERTING_PLUGIN_PATH, + tar_target="/var") - # install plugins - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(settings.LMA_COLLECTOR_PLUGIN_PATH)) - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH)) - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.INFLUXDB_GRAFANA_PLUGIN_PATH)) - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.LMA_INFRA_ALERTING_PLUGIN_PATH)) + # install plugins + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.LMA_COLLECTOR_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.INFLUXDB_GRAFANA_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.LMA_INFRA_ALERTING_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_lma_infra_alerting/test_plugin_lma_infra_alerting.py b/fuelweb_test/tests/plugins/plugin_lma_infra_alerting/test_plugin_lma_infra_alerting.py index 2dd716106..89033f206 100644 --- a/fuelweb_test/tests/plugins/plugin_lma_infra_alerting/test_plugin_lma_infra_alerting.py +++ b/fuelweb_test/tests/plugins/plugin_lma_infra_alerting/test_plugin_lma_infra_alerting.py @@ -20,8 +20,8 @@ from proboscis import test import requests from fuelweb_test import logger +from fuelweb_test.helpers import utils from fuelweb_test import settings -from fuelweb_test.helpers import checkers from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.tests.base_test_case import SetupEnvironment from fuelweb_test.tests.base_test_case import TestBasic @@ -84,18 +84,16 @@ class TestLmaInfraAlertingPlugin(TestBasic): def _bootstrap(self): - with self.env.d_env.get_admin_remote() as remote: + # copy plugin to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.LMA_INFRA_ALERTING_PLUGIN_PATH, + tar_target="/var") - # copy plugin to the master node - checkers.upload_tarball( - remote, - settings.LMA_INFRA_ALERTING_PLUGIN_PATH, "/var") - - # install plugin - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.LMA_INFRA_ALERTING_PLUGIN_PATH)) + # install plugin + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.LMA_INFRA_ALERTING_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_reboot/test_plugin_reboot_task.py b/fuelweb_test/tests/plugins/plugin_reboot/test_plugin_reboot_task.py index b52808550..8eaba3ae3 100644 --- a/fuelweb_test/tests/plugins/plugin_reboot/test_plugin_reboot_task.py +++ b/fuelweb_test/tests/plugins/plugin_reboot/test_plugin_reboot_task.py @@ -17,7 +17,7 @@ import os from proboscis import asserts from proboscis import test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test import logger from fuelweb_test.settings import DEPLOYMENT_MODE from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -60,28 +60,27 @@ class RebootPlugin(TestBasic): self.env.revert_snapshot("ready_with_5_slaves") # let's get ssh client for the master node - with self.env.d_env.get_admin_remote() as admin_remote: - # initiate fuel plugin builder instance - self.show_step(2) - fpb = FuelPluginBuilder() - # install fuel_plugin_builder on master node - fpb.fpb_install() - # create plugin template on the master node - self.show_step(3) - fpb.fpb_create_plugin(source_plugin_path) - # replace plugin tasks with our file - fpb.fpb_replace_plugin_content( - os.path.join(tasks_path, tasks_file), - os.path.join(source_plugin_path, 'tasks.yaml')) - # build plugin - self.show_step(4) - packet_name = fpb.fpb_build_plugin(source_plugin_path) - fpb.fpb_copy_plugin( - os.path.join(source_plugin_path, packet_name), plugin_path) - self.show_step(5) - checkers.install_plugin_check_code( - admin_remote, - plugin=os.path.join(plugin_path, packet_name)) + # initiate fuel plugin builder instance + self.show_step(2) + fpb = FuelPluginBuilder() + # install fuel_plugin_builder on master node + fpb.fpb_install() + # create plugin template on the master node + self.show_step(3) + fpb.fpb_create_plugin(source_plugin_path) + # replace plugin tasks with our file + fpb.fpb_replace_plugin_content( + os.path.join(tasks_path, tasks_file), + os.path.join(source_plugin_path, 'tasks.yaml')) + # build plugin + self.show_step(4) + packet_name = fpb.fpb_build_plugin(source_plugin_path) + fpb.fpb_copy_plugin( + os.path.join(source_plugin_path, packet_name), plugin_path) + self.show_step(5) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.join(plugin_path, packet_name)) self.show_step(6) # create cluster cluster_id = self.fuel_web.create_cluster( @@ -187,37 +186,36 @@ class RebootPlugin(TestBasic): self.show_step(1, initialize=True) self.env.revert_snapshot("ready_with_3_slaves") # let's get ssh client for the master node - with self.env.d_env.get_admin_remote() as admin_remote: - self.show_step(2) - # initiate fuel plugin builder instance - fpb = FuelPluginBuilder() - # install fuel_plugin_builder on master node - fpb.fpb_install() - # change timeout to a new value '1' - fpb.put_value_to_local_yaml(os.path.join(tasks_path, tasks_file), - os.path.join('/tmp/', tasks_file), - [1, 'parameters', 'timeout'], - 1) - self.show_step(3) - # create plugin template on the master node - fpb.fpb_create_plugin(source_plugin_path) - # replace plugin tasks with our file - fpb.fpb_replace_plugin_content( - os.path.join('/tmp/', tasks_file), - os.path.join(source_plugin_path, 'tasks.yaml')) - # build plugin - self.show_step(4) - packet_name = fpb.fpb_build_plugin(source_plugin_path) - # copy plugin archive file - # to the /var directory on the master node - fpb.fpb_copy_plugin( - os.path.join(source_plugin_path, packet_name), - plugin_path) - # let's install plugin - self.show_step(5) - checkers.install_plugin_check_code( - admin_remote, - plugin=os.path.join(plugin_path, packet_name)) + self.show_step(2) + # initiate fuel plugin builder instance + fpb = FuelPluginBuilder() + # install fuel_plugin_builder on master node + fpb.fpb_install() + # change timeout to a new value '1' + fpb.put_value_to_local_yaml(os.path.join(tasks_path, tasks_file), + os.path.join('/tmp/', tasks_file), + [1, 'parameters', 'timeout'], + 1) + self.show_step(3) + # create plugin template on the master node + fpb.fpb_create_plugin(source_plugin_path) + # replace plugin tasks with our file + fpb.fpb_replace_plugin_content( + os.path.join('/tmp/', tasks_file), + os.path.join(source_plugin_path, 'tasks.yaml')) + # build plugin + self.show_step(4) + packet_name = fpb.fpb_build_plugin(source_plugin_path) + # copy plugin archive file + # to the /var directory on the master node + fpb.fpb_copy_plugin( + os.path.join(source_plugin_path, packet_name), + plugin_path) + # let's install plugin + self.show_step(5) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.join(plugin_path, packet_name)) # create cluster self.show_step(6) cluster_id = self.fuel_web.create_cluster( diff --git a/fuelweb_test/tests/plugins/plugin_vip_reservation/test_plugin_vip_reservation.py b/fuelweb_test/tests/plugins/plugin_vip_reservation/test_plugin_vip_reservation.py index c1fa74bf0..7e81303fb 100644 --- a/fuelweb_test/tests/plugins/plugin_vip_reservation/test_plugin_vip_reservation.py +++ b/fuelweb_test/tests/plugins/plugin_vip_reservation/test_plugin_vip_reservation.py @@ -18,7 +18,7 @@ import os from proboscis import asserts from proboscis import test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test import logger from fuelweb_test.settings import DEPLOYMENT_MODE from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -62,37 +62,36 @@ class VipReservation(TestBasic): self.show_step(1, initialize=True) self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as admin_remote: - # initiate fuel plugin builder instance - fpb = FuelPluginBuilder() - # install fuel_plugin_builder on master node - self.show_step(2) - fpb.fpb_install() - # create plugin template on the master node - self.show_step(3) - fpb.fpb_create_plugin(source_plugin_path) - # replace plugin tasks, metadata, network_roles - fpb.fpb_replace_plugin_content( - os.path.join(dir_path, net_role_file), - os.path.join(source_plugin_path, net_role_file)) - fpb.fpb_replace_plugin_content( - os.path.join(dir_path, tasks_file), - os.path.join(source_plugin_path, tasks_file)) - fpb.fpb_replace_plugin_content( - os.path.join(dir_path, metadata_file), - os.path.join(source_plugin_path, metadata_file)) - # build plugin - self.show_step(4) - packet_name = fpb.fpb_build_plugin(source_plugin_path) - # copy plugin archive file from nailgun container - # to the /var directory on the master node - fpb.fpb_copy_plugin(os.path.join(source_plugin_path, packet_name), - plugin_path) - # let's install plugin - self.show_step(5) - checkers.install_plugin_check_code( - admin_remote, - plugin=os.path.join(plugin_path, packet_name)) + # initiate fuel plugin builder instance + fpb = FuelPluginBuilder() + # install fuel_plugin_builder on master node + self.show_step(2) + fpb.fpb_install() + # create plugin template on the master node + self.show_step(3) + fpb.fpb_create_plugin(source_plugin_path) + # replace plugin tasks, metadata, network_roles + fpb.fpb_replace_plugin_content( + os.path.join(dir_path, net_role_file), + os.path.join(source_plugin_path, net_role_file)) + fpb.fpb_replace_plugin_content( + os.path.join(dir_path, tasks_file), + os.path.join(source_plugin_path, tasks_file)) + fpb.fpb_replace_plugin_content( + os.path.join(dir_path, metadata_file), + os.path.join(source_plugin_path, metadata_file)) + # build plugin + self.show_step(4) + packet_name = fpb.fpb_build_plugin(source_plugin_path) + # copy plugin archive file from nailgun container + # to the /var directory on the master node + fpb.fpb_copy_plugin(os.path.join(source_plugin_path, packet_name), + plugin_path) + # let's install plugin + self.show_step(5) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.join(plugin_path, packet_name)) self.show_step(6) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -185,46 +184,45 @@ class VipReservation(TestBasic): self.show_step(1, initialize=True) self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as admin_remote: - # initiate fuel plugin builder instance - self.show_step(2) - fpb = FuelPluginBuilder() - # install fuel_plugin_builder on master node - fpb.fpb_install() - # create plugin template on the master node - self.show_step(3) - fpb.fpb_create_plugin(source_plugin_path) - # replace plugin tasks, metadata, network_roles - fpb.fpb_replace_plugin_content( - os.path.join(task_path, net_role_file), - os.path.join(source_plugin_path, net_role_file)) - fpb.fpb_replace_plugin_content( - os.path.join(task_path, tasks_file), - os.path.join(source_plugin_path, tasks_file)) - fpb.fpb_replace_plugin_content( - os.path.join(task_path, metadata_file), - os.path.join(source_plugin_path, metadata_file)) + # initiate fuel plugin builder instance + self.show_step(2) + fpb = FuelPluginBuilder() + # install fuel_plugin_builder on master node + fpb.fpb_install() + # create plugin template on the master node + self.show_step(3) + fpb.fpb_create_plugin(source_plugin_path) + # replace plugin tasks, metadata, network_roles + fpb.fpb_replace_plugin_content( + os.path.join(task_path, net_role_file), + os.path.join(source_plugin_path, net_role_file)) + fpb.fpb_replace_plugin_content( + os.path.join(task_path, tasks_file), + os.path.join(source_plugin_path, tasks_file)) + fpb.fpb_replace_plugin_content( + os.path.join(task_path, metadata_file), + os.path.join(source_plugin_path, metadata_file)) - fpb.change_remote_yaml( - path_to_file=os.path.join(source_plugin_path, net_role_file), - element=[0, 'properties', 'vip', 0, 'namespace'], - value=namespace) - fpb.change_remote_yaml( - os.path.join(source_plugin_path, net_role_file), - [1, 'properties', 'vip', 0, 'namespace'], - namespace) - # build plugin - self.show_step(4) - packet_name = fpb.fpb_build_plugin(source_plugin_path) - # copy plugin archive file - # to the /var directory on the master node - fpb.fpb_copy_plugin(os.path.join(source_plugin_path, packet_name), - plugin_path) - # let's install plugin - self.show_step(5) - checkers.install_plugin_check_code( - admin_remote, - plugin=os.path.join(plugin_path, packet_name)) + fpb.change_remote_yaml( + path_to_file=os.path.join(source_plugin_path, net_role_file), + element=[0, 'properties', 'vip', 0, 'namespace'], + value=namespace) + fpb.change_remote_yaml( + os.path.join(source_plugin_path, net_role_file), + [1, 'properties', 'vip', 0, 'namespace'], + namespace) + # build plugin + self.show_step(4) + packet_name = fpb.fpb_build_plugin(source_plugin_path) + # copy plugin archive file + # to the /var directory on the master node + fpb.fpb_copy_plugin(os.path.join(source_plugin_path, packet_name), + plugin_path) + # let's install plugin + self.show_step(5) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.join(plugin_path, packet_name)) self.show_step(6) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -313,46 +311,45 @@ class VipReservation(TestBasic): self.show_step(1, initialize=True) self.env.revert_snapshot("ready_with_3_slaves") - with self.env.d_env.get_admin_remote() as admin_remote: - self.show_step(2) - # initiate fuel plugin builder instance - fpb = FuelPluginBuilder() - # install fuel_plugin_builder on master node - fpb.fpb_install() - # create plugin template on the master node - self.show_step(3) - fpb.fpb_create_plugin(source_plugin_path) - # replace plugin tasks, metadata, network_roles - fpb.fpb_replace_plugin_content( - os.path.join(task_path, net_role_file), - os.path.join(source_plugin_path, net_role_file)) - fpb.fpb_replace_plugin_content( - os.path.join(task_path, tasks_file), - os.path.join(source_plugin_path, tasks_file)) - fpb.fpb_replace_plugin_content( - os.path.join(task_path, metadata_file), - os.path.join(source_plugin_path, metadata_file)) + self.show_step(2) + # initiate fuel plugin builder instance + fpb = FuelPluginBuilder() + # install fuel_plugin_builder on master node + fpb.fpb_install() + # create plugin template on the master node + self.show_step(3) + fpb.fpb_create_plugin(source_plugin_path) + # replace plugin tasks, metadata, network_roles + fpb.fpb_replace_plugin_content( + os.path.join(task_path, net_role_file), + os.path.join(source_plugin_path, net_role_file)) + fpb.fpb_replace_plugin_content( + os.path.join(task_path, tasks_file), + os.path.join(source_plugin_path, tasks_file)) + fpb.fpb_replace_plugin_content( + os.path.join(task_path, metadata_file), + os.path.join(source_plugin_path, metadata_file)) - fpb.change_remote_yaml( - os.path.join(source_plugin_path, net_role_file), - [0, 'properties', 'vip', 0, 'namespace'], - namespace) - fpb.change_remote_yaml( - os.path.join(source_plugin_path, net_role_file), - [1, 'properties', 'vip', 0, 'namespace'], - namespace) - # build plugin - self.show_step(4) - packet_name = fpb.fpb_build_plugin(source_plugin_path) - # copy plugin archive file - # to the /var directory on the master node - fpb.fpb_copy_plugin(os.path.join(source_plugin_path, packet_name), - plugin_path) - self.show_step(5) - # let's install plugin - checkers.install_plugin_check_code( - admin_remote, - plugin=os.path.join(plugin_path, packet_name)) + fpb.change_remote_yaml( + os.path.join(source_plugin_path, net_role_file), + [0, 'properties', 'vip', 0, 'namespace'], + namespace) + fpb.change_remote_yaml( + os.path.join(source_plugin_path, net_role_file), + [1, 'properties', 'vip', 0, 'namespace'], + namespace) + # build plugin + self.show_step(4) + packet_name = fpb.fpb_build_plugin(source_plugin_path) + # copy plugin archive file + # to the /var directory on the master node + fpb.fpb_copy_plugin(os.path.join(source_plugin_path, packet_name), + plugin_path) + self.show_step(5) + # let's install plugin + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.join(plugin_path, packet_name)) self.show_step(6) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, diff --git a/fuelweb_test/tests/plugins/plugin_zabbix/test_plugin_zabbix.py b/fuelweb_test/tests/plugins/plugin_zabbix/test_plugin_zabbix.py index 87c5a341f..37be4e51c 100644 --- a/fuelweb_test/tests/plugins/plugin_zabbix/test_plugin_zabbix.py +++ b/fuelweb_test/tests/plugins/plugin_zabbix/test_plugin_zabbix.py @@ -23,7 +23,7 @@ from proboscis.asserts import assert_true from proboscis import test import requests -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -167,12 +167,13 @@ class ZabbixPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_5_slaves") - with self.env.d_env.get_admin_remote() as remote: - checkers.upload_tarball( - remote, settings.ZABBIX_PLUGIN_PATH, "/var") - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(settings.ZABBIX_PLUGIN_PATH)) + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.ZABBIX_PLUGIN_PATH, + tar_target="/var") + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.ZABBIX_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -249,14 +250,15 @@ class ZabbixPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_5_slaves") - with self.env.d_env.get_admin_remote() as remote: - for plugin in [settings.ZABBIX_PLUGIN_PATH, - settings.ZABBIX_SNMP_PLUGIN_PATH]: - checkers.upload_tarball( - remote, plugin, "/var") - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(plugin)) + for plugin in [settings.ZABBIX_PLUGIN_PATH, + settings.ZABBIX_SNMP_PLUGIN_PATH]: + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=plugin, + tar_target="/var") + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(plugin)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -346,15 +348,16 @@ class ZabbixPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_5_slaves") - with self.env.d_env.get_admin_remote() as remote: - for plugin in [settings.ZABBIX_PLUGIN_PATH, - settings.ZABBIX_SNMP_PLUGIN_PATH, - settings.ZABBIX_SNMP_EMC_PLUGIN_PATH]: - checkers.upload_tarball( - remote, plugin, "/var") - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(plugin)) + for plugin in [settings.ZABBIX_PLUGIN_PATH, + settings.ZABBIX_SNMP_PLUGIN_PATH, + settings.ZABBIX_SNMP_EMC_PLUGIN_PATH]: + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=plugin, + tar_target="/var") + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(plugin)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -428,15 +431,16 @@ class ZabbixPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_5_slaves") - with self.env.d_env.get_admin_remote() as remote: - for plugin in [settings.ZABBIX_PLUGIN_PATH, - settings.ZABBIX_SNMP_PLUGIN_PATH, - settings.ZABBIX_SNMP_EXTREME_PLUGIN_PATH]: - checkers.upload_tarball( - remote, plugin, "/var") - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(plugin)) + for plugin in [settings.ZABBIX_PLUGIN_PATH, + settings.ZABBIX_SNMP_PLUGIN_PATH, + settings.ZABBIX_SNMP_EXTREME_PLUGIN_PATH]: + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=plugin, + tar_target="/var") + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(plugin)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, @@ -510,12 +514,13 @@ class ZabbixPlugin(TestBasic): """ self.env.revert_snapshot("ready_with_5_slaves") - with self.env.d_env.get_admin_remote() as remote: - checkers.upload_tarball( - remote, settings.ZABBIX_PLUGIN_PATH, "/var") - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(settings.ZABBIX_PLUGIN_PATH)) + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.ZABBIX_PLUGIN_PATH, + tar_target="/var") + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(settings.ZABBIX_PLUGIN_PATH)) cluster_settings = {} if settings.NEUTRON_ENABLE: diff --git a/fuelweb_test/tests/test_ceph.py b/fuelweb_test/tests/test_ceph.py index ab1628294..3c4e94ed1 100644 --- a/fuelweb_test/tests/test_ceph.py +++ b/fuelweb_test/tests/test_ceph.py @@ -25,6 +25,7 @@ from devops.helpers.helpers import wait from fuelweb_test.helpers import os_actions from fuelweb_test.helpers import ceph from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers.ovs import ovs_get_tag_by_port from fuelweb_test import ostf_test_mapping @@ -857,10 +858,9 @@ class CheckCephPartitionsAfterReboot(TestBasic): self.show_step(7, node) logger.info("Get partitions for {node}".format(node=node)) _ip = self.fuel_web.get_nailgun_node_by_name(node)['ip'] - with self.env.d_env.get_ssh_to_remote(_ip) as remote: - before_reboot_partitions = [checkers.get_ceph_partitions( - remote, - "/dev/vd{p}".format(p=part)) for part in ["b", "c"]] + before_reboot_partitions = [utils.get_ceph_partitions( + _ip, + "/dev/vd{p}".format(p=part)) for part in ["b", "c"]] self.show_step(8, node) logger.info("Warm-restart nodes") @@ -872,10 +872,9 @@ class CheckCephPartitionsAfterReboot(TestBasic): node=node )) _ip = self.fuel_web.get_nailgun_node_by_name(node)['ip'] - with self.env.d_env.get_ssh_to_remote(_ip) as remote: - after_reboot_partitions = [checkers.get_ceph_partitions( - remote, - "/dev/vd{p}".format(p=part)) for part in ["b", "c"]] + after_reboot_partitions = [utils.get_ceph_partitions( + _ip, + "/dev/vd{p}".format(p=part)) for part in ["b", "c"]] if before_reboot_partitions != after_reboot_partitions: logger.info("Partitions don`t match") @@ -894,10 +893,9 @@ class CheckCephPartitionsAfterReboot(TestBasic): self.show_step(12, node) _ip = self.fuel_web.get_nailgun_node_by_name(node)['ip'] - with self.env.d_env.get_ssh_to_remote(_ip) as remote: - after_reboot_partitions = [checkers.get_ceph_partitions( - remote, - "/dev/vd{p}".format(p=part)) for part in ["b", "c"]] + after_reboot_partitions = [utils.get_ceph_partitions( + _ip, + "/dev/vd{p}".format(p=part)) for part in ["b", "c"]] if before_reboot_partitions != after_reboot_partitions: logger.info("Partitions don`t match") diff --git a/fuelweb_test/tests/test_services.py b/fuelweb_test/tests/test_services.py index 1d25d4753..348d814ef 100644 --- a/fuelweb_test/tests/test_services.py +++ b/fuelweb_test/tests/test_services.py @@ -19,6 +19,7 @@ from proboscis import test from proboscis.asserts import assert_equal from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers import os_actions from fuelweb_test import settings @@ -547,8 +548,7 @@ class CeilometerHAOneControllerMongo(OSTFCeilometerHelper): ignore_count_of_proccesses=True) _ip = self.fuel_web.get_nailgun_node_by_name("slave-03")['ip'] - with self.env.d_env.get_ssh_to_remote(_ip) as remote: - partitions = checkers.get_mongo_partitions(remote, "vda5") + partitions = utils.get_mongo_partitions(_ip, "vda5") assert_equal(partitions[0].rstrip(), mongo_disk_gb, 'Mongo size {0} before deployment is not equal' diff --git a/fuelweb_test/tests/tests_deployments/tests_neutron_tun/test_ha_tun_group_3.py b/fuelweb_test/tests/tests_deployments/tests_neutron_tun/test_ha_tun_group_3.py index 228ecf4ec..b22dc6349 100644 --- a/fuelweb_test/tests/tests_deployments/tests_neutron_tun/test_ha_tun_group_3.py +++ b/fuelweb_test/tests/tests_deployments/tests_neutron_tun/test_ha_tun_group_3.py @@ -106,7 +106,6 @@ class HaTunGroup3(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -116,9 +115,8 @@ class HaTunGroup3(TestBasic): self.fuel_web.verify_network(cluster_id) self.fuel_web.deploy_cluster_wait(cluster_id) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) ctrls = self.fuel_web.get_nailgun_cluster_nodes_by_roles( cluster_id, roles=['controller']) @@ -192,7 +190,6 @@ class HaTunGroup3(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -202,10 +199,9 @@ class HaTunGroup3(TestBasic): self.fuel_web.verify_network(cluster_id) self.fuel_web.deploy_cluster_wait(cluster_id) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - # TODO: add pool size check - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + # TODO: add pool size check + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) self.fuel_web.check_ceph_status(cluster_id) self.fuel_web.verify_network(cluster_id) diff --git a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_1.py b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_1.py index 38d1c88df..955590cf2 100644 --- a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_1.py +++ b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_1.py @@ -82,7 +82,6 @@ class HaVlanGroup1(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -91,9 +90,8 @@ class HaVlanGroup1(TestBasic): self.fuel_web.check_ceph_status(cluster_id) self.fuel_web.verify_network(cluster_id) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) self.fuel_web.run_ostf(cluster_id=cluster_id) @@ -155,7 +153,6 @@ class HaVlanGroup1(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -164,9 +161,8 @@ class HaVlanGroup1(TestBasic): self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.check_ceph_status(cluster_id) self.fuel_web.verify_network(cluster_id) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) self.fuel_web.run_ostf(cluster_id=cluster_id) diff --git a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_4.py b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_4.py index 94759bb85..ab1127d79 100644 --- a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_4.py +++ b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_4.py @@ -79,17 +79,15 @@ class HaVlanGroup4(TestBasic): } ) self.show_step(6) - n_cinders = self.fuel_web.get_nailgun_cluster_nodes_by_roles( + cinders = self.fuel_web.get_nailgun_cluster_nodes_by_roles( cluster_id=cluster_id, roles=['cinder'], role_status='pending_roles' ) - for node in n_cinders: + for node in cinders: cinder_image_size = self.fuel_web.update_node_partitioning(node) - d_cinders = self.fuel_web.get_devops_nodes_by_nailgun_nodes(n_cinders) - self.show_step(7) self.fuel_web.verify_network(cluster_id) @@ -100,9 +98,8 @@ class HaVlanGroup4(TestBasic): self.fuel_web.verify_network(cluster_id) self.show_step(10) - for d_cinder in d_cinders: - with self.fuel_web.get_ssh_for_node(d_cinder.name) as remote: - checkers.check_cinder_image_size(remote, cinder_image_size) + for cinder in cinders: + checkers.check_cinder_image_size(cinder['ip'], cinder_image_size) self.show_step(11) self.fuel_web.run_ostf(cluster_id) diff --git a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_5.py b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_5.py index 7f6e274fd..875129e9c 100644 --- a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_5.py +++ b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_5.py @@ -167,7 +167,6 @@ class HaVlanGroup5(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -175,7 +174,6 @@ class HaVlanGroup5(TestBasic): cinder_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['cinder'], role_status='pending_roles') - d_cinder = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for cinder_node in cinder_nodes: cinder_image_size = self.fuel_web.\ update_node_partitioning(cinder_node, node_role='cinder') @@ -189,13 +187,11 @@ class HaVlanGroup5(TestBasic): self.show_step(13) self.fuel_web.verify_network(cluster_id) self.show_step(14) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) - for devops_cinder in d_cinder: - with self.fuel_web.get_ssh_for_node(devops_cinder.name) as remote: - checkers.check_cinder_image_size(remote, cinder_image_size) + for cinder in cinder_nodes: + checkers.check_cinder_image_size(cinder['ip'], cinder_image_size) self.show_step(15) self.fuel_web.run_ostf(cluster_id=cluster_id) diff --git a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_6.py b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_6.py index 8c98ce243..6d8191948 100644 --- a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_6.py +++ b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_6.py @@ -92,7 +92,6 @@ class HaVlanGroup6(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -105,9 +104,8 @@ class HaVlanGroup6(TestBasic): self.fuel_web.verify_network(cluster_id) self.show_step(11) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) self.show_step(12) self.fuel_web.run_ostf(cluster_id=cluster_id) @@ -179,7 +177,6 @@ class HaVlanGroup6(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -193,9 +190,8 @@ class HaVlanGroup6(TestBasic): self.show_step(10) self.fuel_web.verify_network(cluster_id) self.show_step(11) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) self.show_step(12) self.fuel_web.run_ostf(cluster_id=cluster_id) diff --git a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_7.py b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_7.py index 31efc344c..5ec905959 100644 --- a/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_7.py +++ b/fuelweb_test/tests/tests_deployments/tests_neutron_vlan/test_ha_vlan_group_7.py @@ -85,7 +85,6 @@ class HaVlanGroup7(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -94,9 +93,8 @@ class HaVlanGroup7(TestBasic): self.fuel_web.check_ceph_status(cluster_id) self.fuel_web.verify_network(cluster_id) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) self.fuel_web.run_ostf(cluster_id=cluster_id) diff --git a/fuelweb_test/tests/tests_multirole/test_multirole_group_1.py b/fuelweb_test/tests/tests_multirole/test_multirole_group_1.py index 08ee22496..66c16b828 100644 --- a/fuelweb_test/tests/tests_multirole/test_multirole_group_1.py +++ b/fuelweb_test/tests/tests_multirole/test_multirole_group_1.py @@ -83,7 +83,6 @@ class MultiroleGroup1(TestBasic): ceph_nodes = self.fuel_web.\ get_nailgun_cluster_nodes_by_roles(cluster_id, ['ceph-osd'], role_status='pending_roles') - d_ceph = self.fuel_web.get_devops_nodes_by_nailgun_nodes(ceph_nodes) for ceph_node in ceph_nodes: ceph_image_size = self.fuel_web.\ update_node_partitioning(ceph_node, node_role='ceph') @@ -96,9 +95,8 @@ class MultiroleGroup1(TestBasic): self.fuel_web.verify_network(cluster_id) self.show_step(10) - for devops_ceph in d_ceph: - with self.fuel_web.get_ssh_for_node(devops_ceph.name) as remote: - checkers.check_ceph_image_size(remote, ceph_image_size) + for ceph in ceph_nodes: + checkers.check_ceph_image_size(ceph['ip'], ceph_image_size) self.show_step(11) self.fuel_web.run_ostf(cluster_id=cluster_id) diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_db.py b/fuelweb_test/tests/tests_separate_services/test_separate_db.py index f3af169fb..614e64564 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_db.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_db.py @@ -19,6 +19,7 @@ from proboscis import test from devops.helpers.helpers import wait from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test import logger @@ -52,20 +53,19 @@ class SeparateDb(TestBasic): self.check_run("separate_db_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, "/var") + # install plugins - # install plugins - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) data = { 'tenant': 'separatedb', diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_db_ceph.py b/fuelweb_test/tests/tests_separate_services/test_separate_db_ceph.py index 753666239..bec2f183a 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_db_ceph.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_db_ceph.py @@ -17,7 +17,7 @@ import os from proboscis.asserts import assert_true from proboscis import test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -51,20 +51,19 @@ class SeparateDbCeph(TestBasic): self.check_run("separate_db_ceph_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, "/var") + # install plugins - # install plugins - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) data = { 'volumes_lvm': False, diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_horizon.py b/fuelweb_test/tests/tests_separate_services/test_separate_horizon.py index 5e8c51e14..5541d5da7 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_horizon.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_horizon.py @@ -18,7 +18,7 @@ from proboscis import test from proboscis.asserts import assert_true from devops.helpers.helpers import wait -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test import logger @@ -52,20 +52,19 @@ class SeparateHorizon(TestBasic): self.check_run("separate_horizon_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_HORIZON_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_HORIZON_PLUGIN_PATH, "/var") + # install plugins - # install plugins - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_HORIZON_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_HORIZON_PLUGIN_PATH)) data = { 'volumes_lvm': False, diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_keystone.py b/fuelweb_test/tests/tests_separate_services/test_separate_keystone.py index 54e1357dc..72ca7a1af 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_keystone.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_keystone.py @@ -19,6 +19,7 @@ from proboscis.asserts import assert_true from devops.helpers.helpers import wait from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test import logger @@ -53,29 +54,29 @@ class SeparateKeystone(TestBasic): self.check_run("separate_keystone_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, "/var") + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH, "/var") + # install plugins - # install plugins + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH)) data = { 'tenant': 'separatekeystone', diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_keystone_ceph.py b/fuelweb_test/tests/tests_separate_services/test_separate_keystone_ceph.py index 02e44493b..666d56780 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_keystone_ceph.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_keystone_ceph.py @@ -17,7 +17,7 @@ import os from proboscis import test from proboscis.asserts import assert_true -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -50,29 +50,29 @@ class SeparateKeystoneCeph(TestBasic): self.check_run("separate_keystone_ceph_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, "/var") + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH, "/var") + # install plugins - # install plugins + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH)) data = { 'volumes_lvm': False, diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_multiroles.py b/fuelweb_test/tests/tests_separate_services/test_separate_multiroles.py index 3d9158886..e1a664cfb 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_multiroles.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_multiroles.py @@ -18,7 +18,7 @@ from proboscis import test from proboscis.asserts import assert_true from devops.helpers.helpers import wait -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test import logger @@ -53,38 +53,39 @@ class SeparateAllServices(TestBasic): self.check_run("separate_all_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH, "/var") + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH, "/var") + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH, "/var") + # install plugins - # install plugins + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_DB_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH)) - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH)) - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_KEYSTONE_PLUGIN_PATH)) data = { 'tenant': 'separateall', diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq.py b/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq.py index 353586dd1..7cd3a4ebe 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq.py @@ -19,6 +19,7 @@ from proboscis import test from devops.helpers.helpers import wait from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test import logger @@ -52,20 +53,19 @@ class SeparateRabbit(TestBasic): self.check_run("separate_rabbit_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH, "/var") + # install plugins - # install plugins - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH)) data = { 'tenant': 'separaterabbit', diff --git a/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq_ceph.py b/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq_ceph.py index a58573d18..0f3ed1da4 100644 --- a/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq_ceph.py +++ b/fuelweb_test/tests/tests_separate_services/test_separate_rabbitmq_ceph.py @@ -17,7 +17,7 @@ import os from proboscis.asserts import assert_true from proboscis import test -from fuelweb_test.helpers import checkers +from fuelweb_test.helpers import utils from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import settings from fuelweb_test.tests.base_test_case import SetupEnvironment @@ -50,20 +50,19 @@ class SeparateRabbitCeph(TestBasic): self.check_run("separate_rabbit_ceph_service") self.env.revert_snapshot("ready_with_9_slaves") - with self.env.d_env.get_admin_remote() as remote: + # copy plugins to the master node - # copy plugins to the master node + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH, + tar_target="/var") - checkers.upload_tarball( - remote, - settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH, "/var") + # install plugins - # install plugins - - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename( - settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename( + settings.SEPARATE_SERVICE_RABBIT_PLUGIN_PATH)) data = { 'volumes_lvm': False, diff --git a/system_test/actions/plugins_actions.py b/system_test/actions/plugins_actions.py index 18a9a1a2f..407cc2f0a 100644 --- a/system_test/actions/plugins_actions.py +++ b/system_test/actions/plugins_actions.py @@ -16,8 +16,7 @@ import os from proboscis.asserts import assert_true, assert_equal -from fuelweb_test.helpers import checkers - +from fuelweb_test.helpers import utils from system_test import logger from system_test import action from system_test import deferred_decorator @@ -49,10 +48,10 @@ class PluginsActions(object): # copy plugin to the master node assert_true(self.plugin_path, "plugin_path is not specified") - with self.env.d_env.get_admin_remote() as remote: - checkers.upload_tarball( - remote, - self.plugin_path, '/var') + utils.upload_tarball( + ip=self.ssh_manager.admin_ip, + tar_path=self.plugin_path, + tar_target='/var') @deferred_decorator([make_snapshot_if_step_fail]) @action @@ -60,10 +59,9 @@ class PluginsActions(object): """Install plugin to Fuel""" assert_true(self.plugin_path, "plugin_path is not specified") - with self.env.d_env.get_admin_remote() as remote: - checkers.install_plugin_check_code( - remote, - plugin=os.path.basename(self.plugin_path)) + utils.install_plugin_check_code( + ip=self.ssh_manager.admin_ip, + plugin=os.path.basename(self.plugin_path)) @deferred_decorator([make_snapshot_if_step_fail]) @action