From 8b13de4224400f8c2d1f4eb12aedb122c24cf86f Mon Sep 17 00:00:00 2001 From: xudan Date: Tue, 27 Mar 2018 03:12:57 -0400 Subject: Decoupling Functest Docker config items from source code There are some special Docker setting item when creating Functest Containers. 1. Remove the extra settings which are required by Functest Danube. 2. Remove the settings for pushing results to DB because Dovetail plans to disable this function. 3. Move the other special Functest settings to config files. JIRA: DOVETAIL-639 Change-Id: Ibc4090b5c0aafdf9ed64e65a9a92e34a12a16df5 Signed-off-by: xudan --- dovetail/container.py | 38 ++++++++------------------------------ dovetail/utils/dovetail_config.py | 12 ++++++++++++ etc/conf/functest_config.yml | 4 +++- etc/testcase/osinterop.tc001.yml | 1 + etc/testcase/sdnvpn.tc001.yml | 2 -- etc/testcase/sdnvpn.tc002.yml | 2 -- etc/testcase/sdnvpn.tc003.yml | 2 -- etc/testcase/sdnvpn.tc004.yml | 2 -- etc/testcase/sdnvpn.tc008.yml | 2 -- etc/testcase/vnf.tc001.yml | 2 -- 10 files changed, 24 insertions(+), 43 deletions(-) diff --git a/dovetail/container.py b/dovetail/container.py index 5c16d802..4feed802 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -61,31 +61,6 @@ class Container(object): "File {} doesn't exist.".format(dovetail_config['openrc'])) return None - # set functest envs and TEST_DB_URL for creating functest container - @staticmethod - def set_functest_config(testcase_name): - - # These are all just used by Functest's function push_results_to_db. - # And has nothing to do with DoveTail running test cases. - ins_type = "unknown" - scenario = "unknown" - ins_type = ''.join([" -e INSTALLER_TYPE=", ins_type]) - scenario = ''.join([" -e DEPLOY_SCENARIO=", scenario]) - ins_ip = os.getenv('INSTALLER_IP', "192.168.0.0") - ins_ip = " -e INSTALLER_IP={}".format(ins_ip) - envs = "%s %s %s" % (ins_type, scenario, ins_ip) - - dovetail_config = dt_cfg.dovetail_config - if dovetail_config['report_dest'].startswith("http"): - report = " -e TEST_DB_URL=%s " % dovetail_config['report_dest'] - if dovetail_config['report_dest'] == "file": - func_res_conf = dovetail_config["functest"]['result'] - file_path = os.path.join(func_res_conf['dir'], - func_res_conf['file_path']) - report = " -e TEST_DB_URL=file://%s " % file_path - key_vol = " -v /root/.ssh/id_rsa:/root/.ssh/id_rsa " - return "%s %s %s" % (envs, report, key_vol) - # set yardstick external network name and log volume for its container. # external network is necessary for yardstick. @classmethod @@ -160,16 +135,17 @@ class Container(object): def create(cls, type, testcase_name): dovetail_config = dt_cfg.dovetail_config docker_image = cls.get_docker_image(type) - opts = dovetail_config[type]['opts'] # credentials file openrc.sh is neccessary openrc = cls.openrc_volume(type) if not openrc: return None + opts = dt_cfg.get_opts(type) + envs = dt_cfg.get_envs(type) + # CI_DEBUG is used for showing the debug logs of the upstream projects # BUILD_TAG is the unique id for this test - envs = ' -e NODE_NAME=master' DEBUG = os.getenv('DEBUG') if DEBUG is not None and DEBUG.lower() == "true": envs = envs + ' -e CI_DEBUG=true' @@ -180,9 +156,11 @@ class Container(object): hosts_config = dt_utils.get_hosts_info(cls.logger) - config = "" - if type.lower() == "functest": - config = cls.set_functest_config(testcase_name) + # This part will be totally removed after remove the 3 functions + # set_functest_config has been removed + # set_yardstick_config + # set_bottlenecks_config + config = " " if type.lower() == "yardstick": config = cls.set_yardstick_config() if type.lower() == "bottlenecks": diff --git a/dovetail/utils/dovetail_config.py b/dovetail/utils/dovetail_config.py index b152cc8a..316be312 100644 --- a/dovetail/utils/dovetail_config.py +++ b/dovetail/utils/dovetail_config.py @@ -64,3 +64,15 @@ class DovetailConfig(object): def update_cmds(cls): if cls.dovetail_config['report_dest'].startswith("http"): cls.dovetail_config['bottlenecks']['cmds'][0] += ' --report' + + @classmethod + def get_opts(cls, valid_type): + if 'opts' in cls.dovetail_config[valid_type].keys(): + return cls.dovetail_config[valid_type]['opts'] + return "" + + @classmethod + def get_envs(cls, valid_type): + if 'envs' in cls.dovetail_config[valid_type].keys(): + return cls.dovetail_config[valid_type]['envs'] + return "" diff --git a/etc/conf/functest_config.yml b/etc/conf/functest_config.yml index e34fa60f..e5f21a9c 100644 --- a/etc/conf/functest_config.yml +++ b/etc/conf/functest_config.yml @@ -3,11 +3,13 @@ functest: image_name: opnfv/functest-restapi docker_tag: euphrates opts: '-id --privileged=true' + envs: '-e INSTALLER_TYPE=unknown -e DEPLOY_SCENARIO=unknown -e NODE_NAME=unknown + -e TEST_DB_URL=file:///home/opnfv/functest/results/functest_results.txt' config: dir: '/home/opnfv/userconfig' images: '/home/opnfv/functest/images' pre_condition: - - 'echo test for precondition in functest' + - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' cmds: - 'functest env prepare' - 'functest testcase run {{validate_testcase}} -r' diff --git a/etc/testcase/osinterop.tc001.yml b/etc/testcase/osinterop.tc001.yml index 865ee2a1..f0eb4b55 100644 --- a/etc/testcase/osinterop.tc001.yml +++ b/etc/testcase/osinterop.tc001.yml @@ -10,6 +10,7 @@ dovetail.osinterop.tc001: testcase: refstack_defcore pre_condition: - 'cp /home/opnfv/userconfig/pre_config/tempest_conf.yaml /usr/lib/python2.7/site-packages/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml' + - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' pre_copy: src_file: osinterop.txt dest_path: /usr/lib/python2.7/site-packages/functest/opnfv_tests/openstack/refstack_client/defcore.txt diff --git a/etc/testcase/sdnvpn.tc001.yml b/etc/testcase/sdnvpn.tc001.yml index 56d73708..698b0d2e 100644 --- a/etc/testcase/sdnvpn.tc001.yml +++ b/etc/testcase/sdnvpn.tc001.yml @@ -5,8 +5,6 @@ dovetail.sdnvpn.tc001: validate: type: functest testcase: bgpvpn - pre_condition: - - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' pre_copy: exist_src_file: sdnvpn_config_testcase1.yaml dest_path: /usr/lib/python2.7/site-packages/sdnvpn/test/functest/config.yaml diff --git a/etc/testcase/sdnvpn.tc002.yml b/etc/testcase/sdnvpn.tc002.yml index 70926c4c..4823ee55 100644 --- a/etc/testcase/sdnvpn.tc002.yml +++ b/etc/testcase/sdnvpn.tc002.yml @@ -5,8 +5,6 @@ dovetail.sdnvpn.tc002: validate: type: functest testcase: bgpvpn - pre_condition: - - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' pre_copy: exist_src_file: sdnvpn_config_testcase2.yaml dest_path: /usr/lib/python2.7/site-packages/sdnvpn/test/functest/config.yaml diff --git a/etc/testcase/sdnvpn.tc003.yml b/etc/testcase/sdnvpn.tc003.yml index ea74db38..fbf13ca3 100644 --- a/etc/testcase/sdnvpn.tc003.yml +++ b/etc/testcase/sdnvpn.tc003.yml @@ -5,8 +5,6 @@ dovetail.sdnvpn.tc003: validate: type: functest testcase: bgpvpn - pre_condition: - - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' pre_copy: exist_src_file: sdnvpn_config_testcase3.yaml dest_path: /usr/lib/python2.7/site-packages/sdnvpn/test/functest/config.yaml diff --git a/etc/testcase/sdnvpn.tc004.yml b/etc/testcase/sdnvpn.tc004.yml index a4cfe21e..5f44f12d 100644 --- a/etc/testcase/sdnvpn.tc004.yml +++ b/etc/testcase/sdnvpn.tc004.yml @@ -5,8 +5,6 @@ dovetail.sdnvpn.tc004: validate: type: functest testcase: bgpvpn - pre_condition: - - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' pre_copy: exist_src_file: sdnvpn_config_testcase4.yaml dest_path: /usr/lib/python2.7/site-packages/sdnvpn/test/functest/config.yaml diff --git a/etc/testcase/sdnvpn.tc008.yml b/etc/testcase/sdnvpn.tc008.yml index 838136da..d818bf10 100644 --- a/etc/testcase/sdnvpn.tc008.yml +++ b/etc/testcase/sdnvpn.tc008.yml @@ -5,8 +5,6 @@ dovetail.sdnvpn.tc008: validate: type: functest testcase: bgpvpn - pre_condition: - - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' pre_copy: exist_src_file: sdnvpn_config_testcase8.yaml dest_path: /usr/lib/python2.7/site-packages/sdnvpn/test/functest/config.yaml diff --git a/etc/testcase/vnf.tc001.yml b/etc/testcase/vnf.tc001.yml index e0f39582..d2a8d70c 100644 --- a/etc/testcase/vnf.tc001.yml +++ b/etc/testcase/vnf.tc001.yml @@ -5,7 +5,5 @@ dovetail.vnf.tc001: validate: type: functest testcase: cloudify_ims - pre_condition: - - 'cp /home/opnfv/userconfig/pre_config/testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml' report: sub_testcase_list: -- cgit 1.2.3-korg