From 0f5302b5ffb5670fab5d17d88dc53ddcc1fc4988 Mon Sep 17 00:00:00 2001 From: Egor Kotko Date: Thu, 6 Oct 2016 16:49:11 +0200 Subject: [PATCH] Precommit test change: - add revert from custom name snapshot - add possibility pull images from external registry Change-Id: Ib4b4dd600335c4468ebe961af4d296783ac5c5ab --- fuel_ccp_tests/settings.py | 5 ++++ .../tests/system/pre_commit/test_etcd.py | 23 +++++++++--------- .../system/pre_commit/test_glance_api.py | 12 +++++----- .../tests/system/pre_commit/test_heat.py | 24 ++++++++++--------- .../tests/system/pre_commit/test_horizon.py | 13 +++++----- .../tests/system/pre_commit/test_keystone.py | 15 ++++++------ .../tests/system/pre_commit/test_mariadb.py | 14 ++++++----- .../tests/system/pre_commit/test_neutron.py | 14 ++++++----- .../tests/system/pre_commit/test_nova.py | 13 +++++----- .../tests/system/pre_commit/test_sahara.py | 16 +++++++------ .../system/pre_commit/test_stacklight.py | 15 ++++++------ 11 files changed, 90 insertions(+), 74 deletions(-) diff --git a/fuel_ccp_tests/settings.py b/fuel_ccp_tests/settings.py index 2da483f..5c681bb 100644 --- a/fuel_ccp_tests/settings.py +++ b/fuel_ccp_tests/settings.py @@ -15,6 +15,8 @@ import os import pkg_resources import time +from fuel_ccp_tests.helpers import ext + _boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True, '0': False, 'no': False, 'false': False, 'off': False} @@ -224,3 +226,6 @@ LVM_PLUGIN_DIR = os.path.join( '/usr/libexec/kubernetes/kubelet-plugins/volume/exec', LVM_PLUGIN_DIRNAME) LVM_PLUGIN_PATH = os.environ.get("LVM_PLUGIN_PATH", "~/lvm") LVM_FILENAME = os.path.basename(LVM_PLUGIN_PATH) + +PRECOMMIT_SNAPSHOT_NAME = os.environ.get( + 'PRECOMMIT_SNAPSHOT_NAME', ext.SNAPSHOT.ccp_deployed) diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_etcd.py b/fuel_ccp_tests/tests/system/pre_commit/test_etcd.py index c4c41ba..3e73b72 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_etcd.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_etcd.py @@ -15,8 +15,9 @@ import pytest from fuel_ccp_tests import logger +from fuel_ccp_tests import settings from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext + LOG = logger.logger @@ -24,7 +25,7 @@ LOG = logger.logger class TestPreCommitEtcd(object): @pytest.mark.test_etcd_on_commit - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) def test_deploy_os_with_custom_etcd( self, ccpcluster, k8s_actions, config, underlay, show_step): """Precommit test for etcd @@ -41,16 +42,14 @@ class TestPreCommitEtcd(object): """ show_step(1) show_step(2) - k8s_actions.create_registry() - - show_step(3) - ccpcluster.fetch() - - show_step(4) - ccpcluster.update_service('etcd') - - show_step(5) - ccpcluster.build(suppress_output=False) + if settings.REGISTRY == '127.0.0.1:31500': + k8s_actions.create_registry() + show_step(3) + ccpcluster.fetch() + show_step(4) + ccpcluster.update_service('etcd') + show_step(5) + ccpcluster.build(suppress_output=False) show_step(6) ccpcluster.deploy() diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_glance_api.py b/fuel_ccp_tests/tests/system/pre_commit/test_glance_api.py index dcb0929..177f91e 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_glance_api.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_glance_api.py @@ -17,7 +17,6 @@ import pytest from fuel_ccp_tests import logger from fuel_ccp_tests import settings -from fuel_ccp_tests.helpers import ext from fuel_ccp_tests.helpers import post_os_deploy_checks @@ -26,8 +25,7 @@ LOG.addHandler(logger.console) class TestServiceGlance(object): - - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) @pytest.mark.glance_test @pytest.mark.fail_snapshot def test_glance_api(self, config, underlay, @@ -47,9 +45,11 @@ class TestServiceGlance(object): k8sclient = k8scluster.api remote = underlay.remote(host=config.k8s.kube_host) - ccpcluster.fetch() - k8scluster.create_registry() - ccpcluster.build() + if settings.REGISTRY == '127.0.0.1:31500': + k8scluster.create_registry() + ccpcluster.fetch() + ccpcluster.build() + topology_path = os.getcwd() + '/fuel_ccp_tests/templates/' \ 'k8s_templates/k8s_topology.yaml' remote.upload(topology_path, './') diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_heat.py b/fuel_ccp_tests/tests/system/pre_commit/test_heat.py index ae07855..a71f9cc 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_heat.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_heat.py @@ -14,15 +14,15 @@ import pytest from fuel_ccp_tests import logger +from fuel_ccp_tests import settings from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext LOG = logger.logger LOG.addHandler(logger.console) class TestDeployHeat(object): - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) @pytest.mark.heat_component def test_heat_component(self, ccpcluster, k8s_actions, rally): """Heat pre-commit test @@ -36,15 +36,17 @@ class TestDeployHeat(object): 7. Run heat tests Duration 60 min """ - LOG.info('Fetch repositories...') - ccpcluster.fetch() - LOG.info('Update service...') - ccpcluster.update_service('heat') - LOG.info('Create registry') - k8s_actions.create_registry() - LOG.info('Build images') - ccpcluster.build('base-tools', suppress_output=False) - ccpcluster.build(suppress_output=False) + if settings.REGISTRY == '127.0.0.1:31500': + LOG.info('Create registry') + k8s_actions.create_registry() + LOG.info('Fetch repositories...') + ccpcluster.fetch() + LOG.info('Update service...') + ccpcluster.update_service('heat') + LOG.info('Build images') + ccpcluster.build('base-tools', suppress_output=False) + ccpcluster.build(suppress_output=False) + LOG.info('Deploy services') ccpcluster.deploy() LOG.info('Check jobs are ready') diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_horizon.py b/fuel_ccp_tests/tests/system/pre_commit/test_horizon.py index 8197af7..8298a48 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_horizon.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_horizon.py @@ -17,7 +17,6 @@ import pytest from fuel_ccp_tests import logger from fuel_ccp_tests import settings from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext LOG = logger.logger LOG.addHandler(logger.console) @@ -33,7 +32,7 @@ class TestServiceHorizon(object): /horizon-master/openstack_dashboard/test/integration_tests '''.format(registry=settings.REGISTRY, tag='ccp') - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) @pytest.mark.horizon_component def test_horizon_component(self, config, underlay, k8scluster, ccpcluster): @@ -57,10 +56,12 @@ class TestServiceHorizon(object): remote = underlay.remote(host=config.k8s.kube_host) - ccpcluster.fetch() - ccpcluster.update_service('horizon') - k8scluster.create_registry() - ccpcluster.build() + if settings.REGISTRY == '127.0.0.1:31500': + k8scluster.create_registry() + ccpcluster.fetch() + ccpcluster.update_service('horizon') + ccpcluster.build() + topology_path = os.getcwd() + '/fuel_ccp_tests/templates/' \ 'k8s_templates/k8s_topology.yaml' remote.upload(topology_path, settings.CCP_CLI_PARAMS['deploy-config']) diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_keystone.py b/fuel_ccp_tests/tests/system/pre_commit/test_keystone.py index e90ec1d..4d4d6d3 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_keystone.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_keystone.py @@ -13,8 +13,8 @@ # under the License. import pytest +from fuel_ccp_tests import settings from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext class TestPreCommitKeystone(object): @@ -24,7 +24,7 @@ class TestPreCommitKeystone(object): @pytest.mark.keystone_test @pytest.mark.keystone_component - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) def test_deploy_os_with_custom_keystone( self, ccpcluster, k8s_actions, underlay, rally): """ @@ -39,12 +39,13 @@ class TestPreCommitKeystone(object): 8. Run tempest """ + if settings.REGISTRY == '127.0.0.1:31500': + k8s_actions.create_registry() + ccpcluster.fetch() + ccpcluster.update_service('keystone') + ccpcluster.build('base-tools', suppress_output=False) + ccpcluster.build(suppress_output=False) - k8s_actions.create_registry() - ccpcluster.fetch() - ccpcluster.update_service('keystone') - ccpcluster.build('base-tools', suppress_output=False) - ccpcluster.build(suppress_output=False) ccpcluster.deploy() rally.prepare() rally.pull_image() diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_mariadb.py b/fuel_ccp_tests/tests/system/pre_commit/test_mariadb.py index 06d63bf..851de78 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_mariadb.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_mariadb.py @@ -14,8 +14,8 @@ import pytest from fuel_ccp_tests import logger +from fuel_ccp_tests import settings from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext LOG = logger.logger @@ -25,7 +25,7 @@ class TestPreCommitMariadb(object): """ @pytest.mark.test_mariadb_on_commit - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) def test_deploy_os_with_custom_mariadb( self, ccpcluster, k8s_actions, config, underlay, namespace='ccp'): """Precommit test for mariadb @@ -40,10 +40,12 @@ class TestPreCommitMariadb(object): 8. Check db """ - k8s_actions.create_registry() - ccpcluster.fetch() - ccpcluster.update_service('mariadb') - ccpcluster.build(suppress_output=False) + if settings.REGISTRY == '127.0.0.1:31500': + k8s_actions.create_registry() + ccpcluster.fetch() + ccpcluster.update_service('mariadb') + ccpcluster.build(suppress_output=False) + ccpcluster.deploy() post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2500) diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_neutron.py b/fuel_ccp_tests/tests/system/pre_commit/test_neutron.py index 66d8307..46b1599 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_neutron.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_neutron.py @@ -16,7 +16,6 @@ import json import pytest from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext from fuel_ccp_tests import logger from fuel_ccp_tests import settings @@ -39,7 +38,7 @@ class TestPreCommitNeutron(object): """ @pytest.mark.test_neutron_on_commit - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) def test_deploy_os_with_custom_neutron( self, ccpcluster, k8s_actions, rally, underlay, config): """ @@ -54,10 +53,13 @@ class TestPreCommitNeutron(object): """ remote = underlay.remote(host=config.k8s.kube_host) - k8s_actions.create_registry() - ccpcluster.fetch() - ccpcluster.update_service('neutron') - ccpcluster.build(suppress_output=False) + + if settings.REGISTRY == '127.0.0.1:31500': + k8s_actions.create_registry() + ccpcluster.fetch() + ccpcluster.update_service('neutron') + ccpcluster.build(suppress_output=False) + ccpcluster.deploy() rally.prepare() rally.pull_image() diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_nova.py b/fuel_ccp_tests/tests/system/pre_commit/test_nova.py index fdd5afd..e85ecba 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_nova.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_nova.py @@ -14,7 +14,7 @@ import pytest from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext +from fuel_ccp_tests import settings class TestPreCommitNova(object): @@ -32,7 +32,7 @@ class TestPreCommitNova(object): """ @pytest.mark.test_nova_on_commit - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) def test_deploy_os_with_custom_nova( self, ccpcluster, k8s_actions, rally): """ @@ -46,11 +46,12 @@ class TestPreCommitNova(object): 7. Run compute tempest suite """ + if settings.REGISTRY == '127.0.0.1:31500': + k8s_actions.create_registry() + ccpcluster.fetch() + ccpcluster.update_service('nova') + ccpcluster.build(suppress_output=False) - k8s_actions.create_registry() - ccpcluster.fetch() - ccpcluster.update_service('nova') - ccpcluster.build(suppress_output=False) ccpcluster.deploy() rally.prepare() rally.pull_image() diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_sahara.py b/fuel_ccp_tests/tests/system/pre_commit/test_sahara.py index 492826c..b6d59d8 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_sahara.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_sahara.py @@ -13,8 +13,8 @@ # under the License. import pytest +from fuel_ccp_tests import settings from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext class TestPreCommitSahara(object): @@ -22,7 +22,7 @@ class TestPreCommitSahara(object): @pytest.mark.sahara_test @pytest.mark.sahara_component - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) def test_deploy_os_with_custom_sahara( self, ccpcluster, k8s_actions, underlay, rally): """ @@ -38,11 +38,13 @@ class TestPreCommitSahara(object): """ - k8s_actions.create_registry() - ccpcluster.fetch() - ccpcluster.update_service('sahara') - ccpcluster.build('base-tools', suppress_output=False) - ccpcluster.build(suppress_output=False) + if settings.REGISTRY == '127.0.0.1:31500': + k8s_actions.create_registry() + ccpcluster.fetch() + ccpcluster.update_service('sahara') + ccpcluster.build('base-tools', suppress_output=False) + ccpcluster.build(suppress_output=False) + ccpcluster.deploy() rally.prepare() rally.pull_image() diff --git a/fuel_ccp_tests/tests/system/pre_commit/test_stacklight.py b/fuel_ccp_tests/tests/system/pre_commit/test_stacklight.py index 641df4a..5dff016 100644 --- a/fuel_ccp_tests/tests/system/pre_commit/test_stacklight.py +++ b/fuel_ccp_tests/tests/system/pre_commit/test_stacklight.py @@ -16,7 +16,6 @@ import pytest import requests from fuel_ccp_tests.helpers import post_os_deploy_checks -from fuel_ccp_tests.helpers import ext from fuel_ccp_tests import settings @@ -41,7 +40,7 @@ class TestPreStackLight(object): } @pytest.mark.test_stacklight_on_commit - @pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed) + @pytest.mark.revert_snapshot(settings.PRECOMMIT_SNAPSHOT_NAME) def test_deploy_os_with_custom_stack_light( self, ccpcluster, k8s_actions, underlay, config): """ @@ -56,12 +55,14 @@ class TestPreStackLight(object): 8. Run verification """ - remote = underlay.remote(host=config.k8s.kube_host) - k8s_actions.create_registry() - ccpcluster.fetch() - ccpcluster.update_service('stacklight') - ccpcluster.build(suppress_output=False) + + if settings.REGISTRY == '127.0.0.1:31500': + k8s_actions.create_registry() + ccpcluster.fetch() + ccpcluster.update_service('stacklight') + ccpcluster.build(suppress_output=False) + topology_path = os.getcwd() + '/fuel_ccp_tests/templates/' \ 'k8s_templates/stacklight_topology.yaml'