diff options
Diffstat (limited to 'functest/utils')
-rw-r--r--[-rwxr-xr-x] | functest/utils/functest_logger.py | 0 | ||||
-rw-r--r-- | functest/utils/functest_utils.py | 21 | ||||
-rwxr-xr-x | functest/utils/openstack_clean.py | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | functest/utils/openstack_utils.py | 0 |
4 files changed, 17 insertions, 11 deletions
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py index 022211cb..022211cb 100755..100644 --- a/functest/utils/functest_logger.py +++ b/functest/utils/functest_logger.py diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index dbed811a..7cc5029d 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -111,12 +111,13 @@ def get_version(): # if launched through CI the build tag has the following format # jenkins-<project>-<installer>-<pod>-<job>-<branch>-<id> # e.g. jenkins-functest-fuel-opnfv-jump-2-daily-master-190 + # jenkins-functest-fuel-baremetal-weekly-master-8 # use regex to match branch info - rule = "daily-(.+?)-[0-9]*" + rule = "(dai|week)ly-(.+?)-[0-9]*" build_tag = get_build_tag() m = re.search(rule, build_tag) if m: - return m.group(1) + return m.group(2) else: return "unknown" @@ -151,7 +152,13 @@ def get_db_url(): """ Returns DB URL """ - return get_functest_config('results.test_db_url') + # TODO use CONST mechanism + try: + # if TEST_DB_URL declared in env variable, use it! + db_url = os.environ['TEST_DB_URL'] + except KeyError: + db_url = get_functest_config('results.test_db_url') + return db_url def logger_test_results(project, case_name, status, details): @@ -200,13 +207,7 @@ def push_results_to_db(project, case_name, except KeyError as e: logger.error("Please set env var: " + str(e)) return False - rule = "daily-(.+?)-[0-9]*" - m = re.search(rule, build_tag) - if m: - version = m.group(1) - else: - logger.error("Please fix BUILD_TAG env var: " + build_tag) - return False + version = get_version() test_start = dt.fromtimestamp(start_date).strftime('%Y-%m-%d %H:%M:%S') test_stop = dt.fromtimestamp(stop_date).strftime('%Y-%m-%d %H:%M:%S') diff --git a/functest/utils/openstack_clean.py b/functest/utils/openstack_clean.py index 15a8f33d..ce61fcac 100755 --- a/functest/utils/openstack_clean.py +++ b/functest/utils/openstack_clean.py @@ -49,9 +49,14 @@ def remove_instances(nova_client, default_instances): for instance in instances: instance_name = getattr(instance, 'name') instance_id = getattr(instance, 'id') + instance_status = getattr(instance, 'status') + instance_state = getattr(instance, 'OS-EXT-STS:task_state') + logger.debug("'%s', ID=%s " % (instance_name, instance_id)) if (instance_id not in default_instances and - instance_name not in default_instances.values()): + instance_name not in default_instances.values() and + instance_status != 'DELETED' and + (instance_status != 'BUILD' or instance_state != 'deleting')): logger.debug("Removing instance '%s' ..." % instance_id) if os_utils.delete_instance(nova_client, instance_id): logger.debug(" > Request sent.") diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py index ffc870f6..ffc870f6 100755..100644 --- a/functest/utils/openstack_utils.py +++ b/functest/utils/openstack_utils.py |