diff options
-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 00000000..467a83ca --- /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 e31afd49..116b1a6e 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 bc6d0393..218e25f8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -97,6 +97,7 @@ RUN cd ${repos_dir}/parser/tosca2heat/heat-translator && python setup.py install 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 1f1214e0..92dbddff 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 845c5883..b3c4436d 100755 --- a/testcases/OpenStack/tempest/run_tempest.py +++ b/testcases/OpenStack/tempest/run_tempest.py @@ -165,7 +165,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 4aab6195..810f286f 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 b6e3fe11..dd707bc8 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 cb2333d4..d020ebac 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() |