diff options
author | boucherv <valentin.boucher@orange.com> | 2016-08-11 09:06:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-08-11 09:06:09 +0000 |
commit | fe1cdb02640ddf9baae6d09a949a4648264dd482 (patch) | |
tree | 8b8c14c250a929cebb73f20ff6884fc714623296 | |
parent | e648bdc9f4f52208a44936fd8732afbe256a20c2 (diff) | |
parent | 7eefbe8f7ec52d727e8e504e4ddd4ddb57cf569e (diff) |
Merge "Create config_functest patch to update the conf with scenario"
-rw-r--r-- | ci/config_patch.yaml | 9 | ||||
-rwxr-xr-x | ci/prepare_env.py | 24 | ||||
-rw-r--r-- | docker/Dockerfile | 1 | ||||
-rwxr-xr-x | testcases/OpenStack/rally/run_rally-cert.py | 3 | ||||
-rwxr-xr-x | testcases/OpenStack/tempest/run_tempest.py | 3 | ||||
-rwxr-xr-x | testcases/OpenStack/vPing/vPing_ssh.py | 3 | ||||
-rwxr-xr-x | testcases/OpenStack/vPing/vPing_userdata.py | 3 | ||||
-rw-r--r-- | utils/functest_utils.py | 21 |
8 files changed, 58 insertions, 9 deletions
diff --git a/ci/config_patch.yaml b/ci/config_patch.yaml new file mode 100644 index 000000000..467a83ca0 --- /dev/null +++ b/ci/config_patch.yaml @@ -0,0 +1,9 @@ +lxd: + general: + openstack: + image_name: Cirros-0.3.4 + image_file_name: cirros-0.3.4-x86_64-lxc.tar.gz + image_disk_format: raw + + healthcheck: + disk_image: /home/opnfv/functest/data/cirros-0.3.4-x86_64-lxc.tar.gz diff --git a/ci/prepare_env.py b/ci/prepare_env.py index e31afd495..116b1a6e2 100755 --- a/ci/prepare_env.py +++ b/ci/prepare_env.py @@ -46,10 +46,16 @@ CI_SCENARIO = "" CI_DEBUG = False REPOS_DIR = os.getenv('repos_dir') FUNCTEST_REPO = REPOS_DIR + '/functest/' +CONFIG_FUNCTEST_PATH = os.environ["CONFIG_FUNCTEST_YAML"] +CONFIG_PATCH_PATH = os.path.join(os.path.dirname( + CONFIG_FUNCTEST_PATH), "config_patch.yaml") -with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: +with open(CONFIG_FUNCTEST_PATH) as f: functest_yaml = yaml.safe_load(f) +with open(CONFIG_PATCH_PATH) as f: + functest_patch_yaml = yaml.safe_load(f) + FUNCTEST_CONF_DIR = functest_yaml.get("general").get( "directories").get("dir_functest_conf") @@ -183,6 +189,21 @@ def source_rc_file(): logger.debug("Used credentials: %s" % str) +def patch_config_file(): + updated = False + for key in functest_patch_yaml: + if key in CI_SCENARIO: + new_functest_yaml = dict(ft_utils.merge_dicts( + functest_yaml, functest_patch_yaml[key])) + updated = True + + if updated: + os.remove(CONFIG_FUNCTEST_PATH) + with open(CONFIG_FUNCTEST_PATH, "w") as f: + f.write(yaml.dump(new_functest_yaml, default_style='"')) + f.close() + + def verify_deployment(): print_separator() logger.info("Verifying OpenStack services...") @@ -262,6 +283,7 @@ def main(): check_env_variables() create_directories() source_rc_file() + patch_config_file() verify_deployment() install_rally() diff --git a/docker/Dockerfile b/docker/Dockerfile index 6f32b6cf6..57c10f3bb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -94,6 +94,7 @@ RUN /bin/bash ${repos_dir}/parser/tests/parser_install.sh ${repos_dir} RUN ${repos_dir}/rally/install_rally.sh --yes ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img /home/opnfv/functest/data/ +ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-lxc.tar.gz /home/opnfv/functest/data/ ADD http://205.177.226.237:9999/onosfw/firewall_block_image.img /home/opnfv/functest/data/ RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 diff --git a/testcases/OpenStack/rally/run_rally-cert.py b/testcases/OpenStack/rally/run_rally-cert.py index 1f1214e03..92dbddff6 100755 --- a/testcases/OpenStack/rally/run_rally-cert.py +++ b/testcases/OpenStack/rally/run_rally-cert.py @@ -410,7 +410,8 @@ def main(): GLANCE_IMAGE_PATH)) image_id = os_utils.create_glance_image(glance_client, GLANCE_IMAGE_NAME, - GLANCE_IMAGE_PATH) + GLANCE_IMAGE_PATH, + GLANCE_IMAGE_FORMAT) if not image_id: logger.error("Failed to create the Glance image...") exit(-1) diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py index 562249b23..3a8d8d72a 100755 --- a/testcases/OpenStack/tempest/run_tempest.py +++ b/testcases/OpenStack/tempest/run_tempest.py @@ -168,7 +168,8 @@ def create_tempest_resources(): GLANCE_IMAGE_PATH)) image_id = os_utils.create_glance_image(glance_client, GLANCE_IMAGE_NAME, - GLANCE_IMAGE_PATH) + GLANCE_IMAGE_PATH, + GLANCE_IMAGE_FORMAT) if not image_id: logger.error("Failed to create a Glance image...") exit(-1) diff --git a/testcases/OpenStack/vPing/vPing_ssh.py b/testcases/OpenStack/vPing/vPing_ssh.py index 4aab6195a..810f286f1 100755 --- a/testcases/OpenStack/vPing/vPing_ssh.py +++ b/testcases/OpenStack/vPing/vPing_ssh.py @@ -192,7 +192,8 @@ def main(): GLANCE_IMAGE_PATH)) image_id = os_utils.create_glance_image(glance_client, GLANCE_IMAGE_NAME, - GLANCE_IMAGE_PATH) + GLANCE_IMAGE_PATH, + GLANCE_IMAGE_FORMAT) if not image_id: logger.error("Failed to create a Glance image...") exit(EXIT_CODE) diff --git a/testcases/OpenStack/vPing/vPing_userdata.py b/testcases/OpenStack/vPing/vPing_userdata.py index b6e3fe11a..dd707bc8f 100755 --- a/testcases/OpenStack/vPing/vPing_userdata.py +++ b/testcases/OpenStack/vPing/vPing_userdata.py @@ -192,7 +192,8 @@ def main(): GLANCE_IMAGE_PATH)) image_id = os_utils.create_glance_image(glance_client, GLANCE_IMAGE_NAME, - GLANCE_IMAGE_PATH) + GLANCE_IMAGE_PATH, + GLANCE_IMAGE_FORMAT) if not image_id: logger.error("Failed to create a Glance image...") exit(EXIT_CODE) diff --git a/utils/functest_utils.py b/utils/functest_utils.py index cb2333d42..d020ebac8 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -212,10 +212,10 @@ def push_results_to_db(project, case_name, logger, logger.debug(r) return True except Exception, e: - print ("Error [push_results_to_db('%s', '%s', '%s', " + - "'%s', '%s', '%s', '%s', '%s', '%s')]:" % - (url, project, case_name, pod_name, version, - scenario, criteria, build_tag, details)), e + print("Error [push_results_to_db('%s', '%s', '%s', " + + "'%s', '%s', '%s', '%s', '%s', '%s')]:" % + (url, project, case_name, pod_name, version, + scenario, criteria, build_tag, details)), e return False @@ -372,6 +372,19 @@ def check_success_rate(case_name, success_rate): return status +def merge_dicts(dict1, dict2): + for k in set(dict1.keys()).union(dict2.keys()): + if k in dict1 and k in dict2: + if isinstance(dict1[k], dict) and isinstance(dict2[k], dict): + yield (k, dict(merge_dicts(dict1[k], dict2[k]))) + else: + yield (k, dict2[k]) + elif k in dict1: + yield (k, dict1[k]) + else: + yield (k, dict2[k]) + + def check_test_result(test_name, ret, start_time, stop_time): def get_criteria_value(): return get_criteria_by_test(test_name).split('==')[1].strip() |