From 32accc104228d2ee471e7f62c49d895e8786ec0a Mon Sep 17 00:00:00 2001 From: Volodymyr Rozhanskyy Date: Tue, 6 Sep 2016 12:17:16 +0300 Subject: [PATCH] refactored smoke+bvt Change-Id: Ifeda0a0f84fa64f8a893f67ca406f34df5c5813f --- docs/testing/test_suite_smoke_bvt.rst | 22 +-- plugin_test/helpers/plugin.py | 25 ++- plugin_test/helpers/settings.py | 6 +- plugin_test/tests/test_smoke_bvt.py | 237 +++++++++++--------------- 4 files changed, 122 insertions(+), 168 deletions(-) diff --git a/docs/testing/test_suite_smoke_bvt.rst b/docs/testing/test_suite_smoke_bvt.rst index d2ae2cd..fe45981 100644 --- a/docs/testing/test_suite_smoke_bvt.rst +++ b/docs/testing/test_suite_smoke_bvt.rst @@ -71,10 +71,11 @@ Steps a network configuration. 3. Add a node with Controller role. 4. Add a node with Compute + Cinder + Manila-share + Manila-data roles. - 5. Add a node with Base-OS role. + 5. Add a node with Compute + Cinder 6. Enable plugin for new environment 7. Run network check 8. Deploy cluster with plugin. + 9. Verify Manila service basic functionality (share add/mount). Expected results ################ @@ -95,8 +96,7 @@ manila_bvt Description ########### -BVT test for manila plugin. Deploy cluster with a controller, a compute and -cinder roles and install Manila plugin. +BVT test for manila plugin. Verify cluster and manila sevice functionality after deploy in HA mode. Complexity @@ -107,16 +107,16 @@ core Steps ##### - 1. Upload plugins and install. - 2. Create environment with "Neutron with VLAN segmentation" as - network configuration. - 3. Add 3 nodes with Controller role. - 4. Add 1 node with Cinder + Manila-share + Manila-data roles. - 5. Add 1 node with compute role. - 6. Enable plugin for new environment + 2. Create environment with "Neutron with tunneling segmentation" as a network configuration and + Ceph as storage backends. + 3. Enable plugin for new environment + 4. Add 3 node with Controller + ceph-osd roles. + 5. Add a node with Manila-share + Manila-data roles. + 6. Add a node with Compute role. 7. Deploy cluster with plugin. - 8. Run OSTF + 8. Run OSTF. + 9. Verify Manila service basic functionality (share add/mount). Expected results ################ diff --git a/plugin_test/helpers/plugin.py b/plugin_test/helpers/plugin.py index 01c01ea..b0b468d 100644 --- a/plugin_test/helpers/plugin.py +++ b/plugin_test/helpers/plugin.py @@ -13,26 +13,24 @@ License for the specific language governing permissions and limitations under the License. """ -import traceback import os +import traceback -from proboscis.asserts import assert_true +from fuelweb_test.helpers.ssh_manager import SSHManager from fuelweb_test.helpers import utils from fuelweb_test import logger -from fuelweb_test.helpers.ssh_manager import SSHManager +from proboscis.asserts import assert_true from settings import MANILA_IMAGE_PATH +from settings import MANILA_IMAGE_DEST_PATH from settings import MANILA_PLUGIN_PATH from settings import plugin_name -# constant -msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" - - def install_manila_plugin(master_node_ip): """Install plugin packages to the master node.""" + utils.upload_tarball( master_node_ip, MANILA_PLUGIN_PATH, "/var") @@ -41,12 +39,13 @@ def install_manila_plugin(master_node_ip): os.path.basename(MANILA_PLUGIN_PATH)) -def upload_manila_image(master_node_ip, image_dest_path): +def upload_manila_image(master_node_ip, image_dest_path=MANILA_IMAGE_DEST_PATH): """Copy Manila qcow2 image to the master node. :type master_node_ip: string master-node ip :type image_dest_path: string destination path """ + logger.info(image_dest_path) try: logger.info("Start to upload manila image file") @@ -71,9 +70,8 @@ def upload_manila_image(master_node_ip, image_dest_path): def enable_plugin_manila(cluster_id, fuel_web_client): """Enable Manila plugin on cluster.""" assert_true( - fuel_web_client.check_plugin_exists( - cluster_id, plugin_name), - msg) + fuel_web_client.check_plugin_exists(cluster_id, plugin_name), + "Plugin couldn't be enabled. Check plugin version.") options = {'metadata/enabled': True} fuel_web_client.update_plugin_data(cluster_id, plugin_name, options) @@ -81,8 +79,7 @@ def enable_plugin_manila(cluster_id, fuel_web_client): def disable_plugin_manila(cluster_id, fuel_web_client): """Disable Manila plugin on cluster.""" assert_true( - fuel_web_client.check_plugin_exists( - cluster_id, plugin_name), - msg) + fuel_web_client.check_plugin_exists(cluster_id, plugin_name), + "Plugin couldn't be enabled. Check plugin version.") options = {'metadata/enabled': False} fuel_web_client.update_plugin_data(cluster_id, plugin_name, options) diff --git a/plugin_test/helpers/settings.py b/plugin_test/helpers/settings.py index ec24f73..9bb4da7 100644 --- a/plugin_test/helpers/settings.py +++ b/plugin_test/helpers/settings.py @@ -13,9 +13,11 @@ License for the specific language governing permissions and limitations under the License. """ - import os -MANILA_PLUGIN_VERSION = os.environ.get('MANILA_PLUGIN_VERSION') +MANILA_PLUGIN_VERSION = os.environ.get('MANILA_PLUGIN_VERSION', '1.0.1') MANILA_PLUGIN_PATH = os.environ.get('MANILA_PLUGIN_PATH') MANILA_IMAGE_PATH = os.environ.get('MANILA_IMAGE_PATH') +MANILA_IMAGE_DEST_PATH = '/var/www/nailgun/plugins/fuel-plugin-manila-' \ + + MANILA_PLUGIN_VERSION[0:3] \ + + '/repositories/ubuntu' plugin_name = 'fuel-plugin-manila' diff --git a/plugin_test/tests/test_smoke_bvt.py b/plugin_test/tests/test_smoke_bvt.py index d903057..089bfcb 100644 --- a/plugin_test/tests/test_smoke_bvt.py +++ b/plugin_test/tests/test_smoke_bvt.py @@ -13,21 +13,22 @@ License for the specific language governing permissions and limitations under the License. """ -from proboscis import test -from proboscis.asserts import assert_true - from fuelweb_test.helpers.decorators import log_snapshot_after_test -from fuelweb_test.tests.base_test_case import TestBasic -from fuelweb_test.tests.base_test_case import SetupEnvironment from fuelweb_test.settings import DEPLOYMENT_MODE -from fuelweb_test.settings import NEUTRON_SEGMENT_TYPE +from fuelweb_test.tests.base_test_case import SetupEnvironment +from fuelweb_test.tests.base_test_case import TestBasic +from helpers.manila_service_verify import TestPluginCheck from helpers import plugin from helpers import settings +from proboscis.asserts import assert_true +from proboscis.asserts import assert_false +from proboscis import test -@test(groups=['manila_plugin', 'manila_bvt_smoke']) -class TestManilaSmoke(TestBasic): + +@test(groups=['manila_bvt_smoke']) +class ManilaTestClass(TestBasic): """Smoke test suite. The goal of smoke testing is to ensure that the most critical features @@ -43,64 +44,57 @@ class TestManilaSmoke(TestBasic): """Check that plugin can be installed. Scenario: - 1. Upload plugins to the master node - 2. Install plugin. - 3. Ensure that plugin is installed successfully using cli, + 1. Upload plugins to the master node and install plugin. + 2. Ensure that plugin is installed successfully using cli, run command 'fuel plugins list'. Check name, version of plugin. - 4.Create a new environment with following parameters: - * Compute: hypervisor QEMU-KVM + 3.Create a new environment with following parameters: * Networking: Neutron with VLAN segmentation - * Storage: default - * Additional services: default - 5. Enable Manila plugin for new environment. - 6. Attempt to remove enabled plugin. + * Storage: Cinder LVM + 4. Enable Manila plugin for new environment. + 5. Attempt to remove enabled plugin. Verify that plugin cannot be removed when it already enabled, run command 'fuel plugins'. - 7.Disable plugin - 8.Remove Plugin Manila - Verify that plugin is removed, run command 'fuel plugins'. + 6. Disable plugin + 7. Remove Plugin Manila + 8. Verify that plugin is removed, run command 'fuel plugins'. Duration: 20 min """ self.env.revert_snapshot("ready_with_1_slaves") self.show_step(1) - self.show_step(2) plugin.install_manila_plugin(self.ssh_manager.admin_ip) cmd = 'fuel plugins list' output = self.ssh_manager.execute_on_remote( ip=self.ssh_manager.admin_ip, cmd=cmd)['stdout'].pop().split(' ') - self.show_step(3) - # check name + + self.show_step(2) + # check version assert_true( settings.MANILA_PLUGIN_VERSION in output, "Plugin version '{0}' not found.".format( - settings.MANILA_PLUGIN_VERSION) - ) - # check version + settings.MANILA_PLUGIN_VERSION)) + # check name assert_true( settings.plugin_name in output, - "Plugin '{0}' is not installed.".format(settings.plugin_name) - ) + "Plugin '{0}' is not installed.".format(settings.plugin_name)) - self.show_step(4) + self.show_step(3) # Configure new cluster cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', - "net_segment_type": NEUTRON_SEGMENT_TYPE } ) - self.show_step(5) - plugin.enable_plugin_manila( - cluster_id, self.fuel_web) + self.show_step(4) + plugin.enable_plugin_manila(cluster_id, self.fuel_web) - self.show_step(6) + self.show_step(5) cmd = 'fuel plugins --remove {0}=={1}'.format( settings.plugin_name, settings.MANILA_PLUGIN_VERSION) output = self.ssh_manager.execute_on_remote( @@ -109,18 +103,15 @@ class TestManilaSmoke(TestBasic): assert_ec_equal=[1])['stderr'].pop() # check for error message msg = "delete plugin which is enabled for some environment" - assert_true( msg in output, "Expected error message did not found in output" ) + self.show_step(6) + plugin.disable_plugin_manila(cluster_id, self.fuel_web) + self.show_step(7) - plugin.disable_plugin_manila( - cluster_id, self.fuel_web) - - self.show_step(8) - cmd = 'fuel plugins --remove {0}=={1}'.format( settings.plugin_name, settings.MANILA_PLUGIN_VERSION) output = self.ssh_manager.execute_on_remote( @@ -132,6 +123,16 @@ class TestManilaSmoke(TestBasic): "Plugin '{0}' is not removed".format(settings.plugin_name) ) + self.show_step(8) + cmd = 'fuel plugins list' + output = self.ssh_manager.execute_on_remote( + ip=self.ssh_manager.admin_ip, + cmd=cmd)['stdout'].pop().split(' ') + # check name + assert_false( + settings.plugin_name in output, + "Plugin '{0}' is not removed.".format(settings.plugin_name)) + @test(depends_on=[SetupEnvironment.prepare_slaves_3], groups=["manila_smoke"]) @log_snapshot_after_test @@ -139,164 +140,118 @@ class TestManilaSmoke(TestBasic): """Check deployment with Manila plugin and one controller. Scenario: - 1. Upload plugins to the master node + upload Manila_Image - 2. Install plugin. - 3. Create a new environment with following parameters: - * Compute: KVM/QEMU + 1. Install plugins to the master node + upload Manila_Image + 2. Create a new environment with following parameters: * Networking: Neutron with VLAN segmentation - * Storage: Cepth - * Additional services: default + * Storage: Cinder LVM + 3. Enable and configure Manila plugin. 4. Add nodes with following roles: * Controller + * Compute + Cinder + Manila-share + Manila-data * Compute + Cinder - 5. Configure interfaces on nodes. - 6. Configure network settings. - 7. Enable and configure Manila plugin. - 8. Verify networks. - 9. Deploy the cluster. - 10. Run OSTF. + 5. Verify networks. + 6. Deploy the cluster. + 7. Verify Manila service basic functionality (share create/mount). Duration: 2.0 hour """ self.env.revert_snapshot("ready_with_3_slaves") self.show_step(1) - self.show_step(2) plugin.install_manila_plugin(self.ssh_manager.admin_ip) + plugin.upload_manila_image(self.ssh_manager.admin_ip) - # upload manila image to master node - - path = "/var/www/nailgun/plugins/fuel-plugin-manila-1.0/repositories" \ - "/ubuntu" - - manila_image = plugin.upload_manila_image( - self.ssh_manager.admin_ip, - path - ) - - print (manila_image) - assert_true( - manila_image, - "Upload of manila image to master node fail" - ) - - self.show_step(3) - # Configure new cluster + self.show_step(2) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', - "net_segment_type": NEUTRON_SEGMENT_TYPE } ) + self.show_step(3) + plugin.enable_plugin_manila(cluster_id, self.fuel_web) + self.show_step(4) - # Assign role to node self.fuel_web.update_nodes( cluster_id, {'slave-01': ['controller'], - 'slave-02': ['compute', 'cinder'], - 'slave-03': ['base-os'] + 'slave-02': ['compute', 'cinder', 'manila-share', 'manila-data'], + 'slave-03': ['compute', 'cinder'] } ) - self.show_step(5) - self.show_step(6) - self.show_step(7) - plugin.enable_plugin_manila( - cluster_id, self.fuel_web) - - self.show_step(8) self.fuel_web.verify_network(cluster_id) - self.show_step(9) + self.show_step(6) self.fuel_web.deploy_cluster_wait(cluster_id) - self.show_step(10) - self.fuel_web.run_ostf( - cluster_id=cluster_id, test_sets=['smoke', 'sanity']) - self.env.make_snapshot("manilla_install", is_make=True) + self.show_step(7) + TestPluginCheck(self).verify_manila_functionality() @test(depends_on=[SetupEnvironment.prepare_slaves_5], groups=["manila_bvt"]) @log_snapshot_after_test def manila_bvt(self): - """"Check deployment with Manila plugin and one controller. + """Check deployment with Manila plugin and one controller. Scenario: - 1. Upload plugins to the master node + upload Manila_Image - 2. Install plugin. - 3. Create a new environment HA with following parameters: - * Compute: KVM/QEMU - * Networking: Neutron with VLAN segmentation - * Storage: Cepth - * Additional services: default + 1. Install plugins to the master node + upload Manila_Image + 2. Create a new environment with following parameters: + * Networking: Neutron with tunneling segmentation + * Storage: Cinder Ceph + 3. Enable and configure Manila plugin. 4. Add nodes with following roles: - * Controller - * Controller - * Controller - * Compute + Cinder - * Compute + Cinder - 5. Configure interfaces on nodes. - 6. Configure network settings. - 7. Enable and configure Manila plugin. - 8. Verify networks. - 9. Deploy the cluster. - 10. Run OSTF. + * Controller + ceph-osd + * Controller + ceph-osd + * Controller + ceph-osd + * Manila-share + Manila-data + * Compute + 5. Deploy the cluster. + 6. Run OSTF. + 7. Verify Manila service basic functionality (share create/mount). Duration: 2.2 hour """ self.env.revert_snapshot("ready_with_5_slaves") self.show_step(1) - self.show_step(2) plugin.install_manila_plugin(self.ssh_manager.admin_ip) - # upload manila image to master node - path = "/var/www/nailgun/plugins/fuel-plugin-manila-1.0/repositories" \ - "/ubuntu" - manila_image = plugin.upload_manila_image( - self.ssh_manager.admin_ip, - path - ) - print (manila_image) - assert_true( - manila_image, - "Upload of manila image to master node fail" - ) + plugin.upload_manila_image(self.ssh_manager.admin_ip) - self.show_step(3) - # Configure new cluster + self.show_step(2) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', - "net_segment_type": NEUTRON_SEGMENT_TYPE - } + "net_segment_type": 'tun', + 'volumes_lvm': False, + 'volume_ceph': True, + "image_ceph": True, + "ephemeral_ceph": True, + "objects_ceph": True, + } ) + self.show_step(3) + plugin.enable_plugin_manila(cluster_id, self.fuel_web) + self.show_step(4) - # Assign role to node self.fuel_web.update_nodes( cluster_id, - {'slave-01': ['controller'], - 'slave-02': ['controller'], - 'slave-03': ['controller'], - 'slave-04': ['compute', 'cinder'], - 'slave-05': ['compute', 'cinder'] + {'slave-01': ['controller', 'ceph-osd'], + 'slave-02': ['controller', 'ceph-osd'], + 'slave-03': ['controller', 'ceph-osd'], + 'slave-04': ['manila-share', 'manila-data'], + 'slave-05': ['compute'] } ) self.show_step(5) - self.show_step(6) - self.show_step(7) - plugin.enable_plugin_manila( - cluster_id, self.fuel_web) - - self.show_step(8) - self.fuel_web.verify_network(cluster_id) - - self.show_step(9) self.fuel_web.deploy_cluster_wait(cluster_id) - self.show_step(10) - self.fuel_web.run_ostf( - cluster_id=cluster_id, test_sets=['smoke', 'sanity', 'ha']) + self.show_step(6) + self.fuel_web.run_ostf(cluster_id=cluster_id, + test_sets=['smoke', 'sanity', 'ha']) + + self.show_step(7) + TestPluginCheck(self).verify_manila_functionality()