From eab863675d1e479893fb4624736d1f31b421122d Mon Sep 17 00:00:00 2001 From: Dmitry Kalashnik Date: Fri, 19 Feb 2016 16:15:26 +0300 Subject: [PATCH] Add possibility to set number of sequiential deploys New task-based deployment and testing strategy for fuel-library LCM readiness requires tests for several layers. In the most common case it is just rerun deploy for ready cluster without any changes. Second deploy should not break anything. New environment variable DEPLOYMENT_RETRIES will allow us to rerun system test in a several-in-a-row-deploy way and be sure that additional deploys don't break that test. Implements: blueprint fuel-qa-deploy-retries Change-Id: I2b7b6933f9a331fa9f2c16f3893d4aa39d094355 --- fuelweb_test/models/fuel_web_client.py | 46 +++++++++++++++----------- fuelweb_test/settings.py | 1 + 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/fuelweb_test/models/fuel_web_client.py b/fuelweb_test/models/fuel_web_client.py index 46e67d92e..d241e6bf7 100644 --- a/fuelweb_test/models/fuel_web_client.py +++ b/fuelweb_test/models/fuel_web_client.py @@ -735,25 +735,7 @@ class FuelWebClient(object): attributes = self.client.get_cluster_attributes(cluster_id) return attributes['editable']['repo_setup']['repos'] - @download_packages_json - @download_astute_yaml - @duration - @check_repos_management - @custom_repo - def deploy_cluster_wait(self, cluster_id, is_feature=False, - timeout=help_data.DEPLOYMENT_TIMEOUT, interval=30, - check_services=True): - if not is_feature: - logger.info('Deploy cluster %s', cluster_id) - task = self.deploy_cluster(cluster_id) - self.assert_task_success(task, interval=interval, timeout=timeout) - else: - logger.info('Provision nodes of a cluster %s', cluster_id) - task = self.client.provision_nodes(cluster_id) - self.assert_task_success(task, timeout=timeout, interval=interval) - logger.info('Deploy nodes of a cluster %s', cluster_id) - task = self.client.deploy_nodes(cluster_id) - self.assert_task_success(task, timeout=timeout, interval=interval) + def check_deploy_state(self, cluster_id, check_services=True): if check_services: self.assert_ha_services_ready(cluster_id) self.assert_os_services_ready(cluster_id) @@ -789,6 +771,32 @@ class FuelWebClient(object): logger.info('Node status: {}'.format(pretty_log(node_status, indent=1))) + @download_packages_json + @download_astute_yaml + @duration + @check_repos_management + @custom_repo + def deploy_cluster_wait(self, cluster_id, is_feature=False, + timeout=help_data.DEPLOYMENT_TIMEOUT, interval=30, + check_services=True): + if not is_feature and help_data.DEPLOYMENT_RETRIES == 1: + logger.info('Deploy cluster %s', cluster_id) + task = self.deploy_cluster(cluster_id) + self.assert_task_success(task, interval=interval, timeout=timeout) + self.check_deploy_state(cluster_id, check_services) + return + + logger.info('Provision nodes of a cluster %s', cluster_id) + task = self.client.provision_nodes(cluster_id) + self.assert_task_success(task, timeout=timeout, interval=interval) + + for retry_number in range(help_data.DEPLOYMENT_RETRIES): + logger.info('Deploy nodes of a cluster %s, run: %s', + cluster_id, str(retry_number + 1)) + task = self.client.deploy_nodes(cluster_id) + self.assert_task_success(task, timeout=timeout, interval=interval) + self.check_deploy_state(cluster_id, check_services) + def deploy_cluster_wait_progress(self, cluster_id, progress, return_task=None): task = self.deploy_cluster(cluster_id) diff --git a/fuelweb_test/settings.py b/fuelweb_test/settings.py index faf01a744..fe1c84064 100644 --- a/fuelweb_test/settings.py +++ b/fuelweb_test/settings.py @@ -75,6 +75,7 @@ DEPLOYMENT_MODE_SIMPLE = "multinode" DEPLOYMENT_MODE_HA = "ha_compact" DEPLOYMENT_MODE = os.environ.get("DEPLOYMENT_MODE", DEPLOYMENT_MODE_HA) DEPLOYMENT_TIMEOUT = int(os.environ.get("DEPLOYMENT_TIMEOUT", 7800)) +DEPLOYMENT_RETRIES = int(os.environ.get("DEPLOYMENT_RETRIES", 1)) BOOTSTRAP_TIMEOUT = int(os.environ.get("BOOTSTRAP_TIMEOUT", 900)) WAIT_FOR_PROVISIONING_TIMEOUT = int(os.environ.get( "WAIT_FOR_PROVISIONING_TIMEOUT", 1200))