From b2a521336e8dfac4166416cbd30dbe566860e99a Mon Sep 17 00:00:00 2001 From: Ilya Bumarskov Date: Mon, 16 May 2016 12:59:48 +0300 Subject: [PATCH] Fix scale tests for vCenter Change-Id: Ia1530ba3e562592b1c0fdf32dc9de370c1370d2f Closes-bug: #1581464 --- system_test/actions/base.py | 11 +++++--- system_test/actions/ostf_actions.py | 18 +++++++++++++ system_test/actions/vcenter_actions.py | 18 ++++++++----- system_test/tests/vcenter/test_vcenter_dvs.py | 25 ++++++++----------- .../vcenter_add_computevmware.yaml | 5 +++- 5 files changed, 52 insertions(+), 25 deletions(-) diff --git a/system_test/actions/base.py b/system_test/actions/base.py index 5b534e4a6..f051db21d 100644 --- a/system_test/actions/base.py +++ b/system_test/actions/base.py @@ -41,6 +41,7 @@ from system_test import deferred_decorator from system_test.actions.ostf_actions import HealthCheckActions from system_test.actions.plugins_actions import PluginsActions +from system_test.actions.vcenter_actions import VMwareActions from system_test.core.discover import load_yaml from system_test.helpers.decorators import make_snapshot_if_step_fail @@ -240,7 +241,8 @@ class PrepareActions(object): # noinspection PyUnresolvedReferences -class BaseActions(PrepareActions, HealthCheckActions, PluginsActions): +class BaseActions(PrepareActions, HealthCheckActions, PluginsActions, + VMwareActions): """Basic actions for acceptance cases For choosing action order use actions_order variable, set list of actions @@ -501,7 +503,9 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions): self._add_node([node]) if node.get('vmware_vcenter'): nova_computes = node['vmware_vcenter']['nova-compute'] + dvs_settings = node['vmware_dvs'] self.add_vmware_nova_compute(nova_computes) + self.update_dvs_plugin_settings(dvs_settings) elif node['action'] == 'delete': self._del_node([node]) if 'compute-vmware' in node['roles']: @@ -553,8 +557,9 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions): 0]["nova_computes"] comp_vmware_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles( - self.cluster_id, ['compute-vmware'], - role_status='pending_deletion') + self.cluster_id, ['compute-vmware']) + comp_vmware_nodes = [node for node in comp_vmware_nodes if + node['pending_deletion'] is True] for node, nova_comp in itertools.product(comp_vmware_nodes, vcenter_data): diff --git a/system_test/actions/ostf_actions.py b/system_test/actions/ostf_actions.py index 263424013..85b4563ef 100644 --- a/system_test/actions/ostf_actions.py +++ b/system_test/actions/ostf_actions.py @@ -81,3 +81,21 @@ class HealthCheckActions(object): test_sets=['ha'], should_fail=getattr(self, 'ostf_tests_should_failed', 0), failed_test_name=getattr(self, 'failed_test_name', None)) + + @deferred_decorator([make_snapshot_if_step_fail]) + @action + def health_check_platform(self): + """Run health checker Platform + + Skip action if cluster doesn't exist + """ + if self.cluster_id is None: + raise SkipTest( + "The cluster_id is not specified, can not run ostf" + ) + + self.fuel_web.run_ostf( + cluster_id=self.cluster_id, + test_sets=['tests_platform'], + should_fail=getattr(self, 'ostf_tests_should_failed', 0), + failed_test_name=getattr(self, 'failed_test_name', None)) diff --git a/system_test/actions/vcenter_actions.py b/system_test/actions/vcenter_actions.py index 9333fcbc5..806c60211 100644 --- a/system_test/actions/vcenter_actions.py +++ b/system_test/actions/vcenter_actions.py @@ -57,14 +57,20 @@ class VMwareActions(object): self.plugin_name), msg) + dvs_settings = self.full_config['template']['cluster_template'][ + 'settings']['vmware_dvs'] + self.update_dvs_plugin_settings(dvs_settings) + + def update_dvs_plugin_settings(self, dvs_settings): + """Update plugin settings + :param dvs_settings: dict + """ + options = { - 'vmware_dvs_fw_driver/value': self.full_config[ - 'template']['cluster_template']['settings']['vmware_dvs'][ - 'dvs_fw_driver'], - 'vmware_dvs_net_maps/value': self.full_config[ - 'template']['cluster_template']['settings']['vmware_dvs'][ - 'dvswitch_name'] + 'vmware_dvs_fw_driver/value': dvs_settings['dvs_fw_driver'], + 'vmware_dvs_net_maps/value': dvs_settings['dvswitch_name'] } + self.fuel_web.update_plugin_settings( self.cluster_id, self.plugin_name, self.plugin_version, options, enabled=True) diff --git a/system_test/tests/vcenter/test_vcenter_dvs.py b/system_test/tests/vcenter/test_vcenter_dvs.py index 95c0a4775..20a0ea2ff 100644 --- a/system_test/tests/vcenter/test_vcenter_dvs.py +++ b/system_test/tests/vcenter/test_vcenter_dvs.py @@ -103,9 +103,9 @@ class ScaleWithVMware(ActionTest, BaseActions, VMwareActions): @testcase(groups=['system_test', 'system_test.vcenter', - 'system_test.vcenter.scale_vcenter_dvs_skipsrvcheck']) -class ScaleWithVMwareSkipSrvCheck(ActionTest, BaseActions, VMwareActions): - """Deploy and scale cluster with vCenter and dvs plugin + 'system_test.vcenter.deploy_vcenter_dvs_run_platform_ostf']) +class DeployWithVMwareRunPlatformOSTF(ActionTest, BaseActions, VMwareActions): + """Deploy cluster with vCenter and dvs plugin. Run platform OSTF. Scenario: 1. Upload plugin to the master node @@ -114,21 +114,17 @@ class ScaleWithVMwareSkipSrvCheck(ActionTest, BaseActions, VMwareActions): 4. Configure dvs settings (depends on yaml config) 5. Add nodes (depends on yaml config) 6. Configure vmware settings (depends on yaml config) - 7. Run network verification - 8. Deploy the cluster - 9. Add/Delete nodes - 10. Redeploy cluster - 11. Run OSTF + 7. Deploy the cluster + 8. Run OSTF + 9. Run OSTF (platform tests) - Duration 3h 00min - Snapshot scale_vcenter_dvs + Duration 2h 20min + Snapshot deploy_vcenter_dvs """ plugin_name = "fuel-plugin-vmware-dvs" plugin_path = DVS_PLUGIN_PATH plugin_version = DVS_PLUGIN_VERSION - ostf_tests_should_failed = 1 - failed_test_name = ['Check that required services are running'] actions_order = [ 'prepare_env_with_plugin', @@ -138,9 +134,8 @@ class ScaleWithVMwareSkipSrvCheck(ActionTest, BaseActions, VMwareActions): 'configure_vcenter', 'network_check', 'deploy_cluster', - 'scale_node', - 'deploy_changes', - 'health_check_sanity_smoke_ha' + 'health_check_sanity_smoke_ha', + 'health_check_platform' ] diff --git a/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_add_computevmware.yaml b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_add_computevmware.yaml index d8b619ded..f0abbd0a0 100644 --- a/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_add_computevmware.yaml +++ b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_add_computevmware.yaml @@ -44,4 +44,7 @@ template: - cluster: Cluster2 srv_name: srv_cluster2 datastore: .* - target_node: compute-vmware \ No newline at end of file + target_node: compute-vmware + vmware_dvs: + dvswitch_name: !os_env DVS_NAME, Cluster1:dvSwitch;Cluster2:dvSwitch + dvs_fw_driver: false \ No newline at end of file