From 6e69ce0329437fcc5a4181eb4d70e44a6c2dbaa5 Mon Sep 17 00:00:00 2001 From: xudan Date: Wed, 14 Nov 2018 04:42:11 -0500 Subject: Integrate k8s test casses In order to integrate k8s test cases, Dovetail framework should do some refactor and make it more general for k8s test cases as well as ONAP ones. Integrate 2 k8s test cases. JIRA: DOVETAIL-748 Change-Id: Ibd87754ffb5fb29f6b4ce79232af860c2ed2da9c Signed-off-by: xudan --- etc/compliance/proposed_tests.yml | 2 ++ etc/conf/bottlenecks_config.yml | 34 +++++++++++++++++++++++-------- etc/conf/dovetail_config.yml | 1 + etc/conf/functest-k8s_config.yml | 31 ++++++++++++++++++++++++++++ etc/conf/functest_config.yml | 28 ++++++++++++++++++++----- etc/conf/yardstick_config.yml | 30 ++++++++++++++++++++------- etc/testcase/functest.k8s.conformance.yml | 15 ++++++++++++++ etc/testcase/functest.k8s.smoke.yml | 15 ++++++++++++++ 8 files changed, 135 insertions(+), 21 deletions(-) create mode 100644 etc/conf/functest-k8s_config.yml create mode 100644 etc/testcase/functest.k8s.conformance.yml create mode 100644 etc/testcase/functest.k8s.smoke.yml (limited to 'etc') diff --git a/etc/compliance/proposed_tests.yml b/etc/compliance/proposed_tests.yml index ff5908c2..639a0309 100644 --- a/etc/compliance/proposed_tests.yml +++ b/etc/compliance/proposed_tests.yml @@ -5,3 +5,5 @@ proposed_tests: testcases_list: mandatory: optional: + - functest.k8s.conformance + - functest.k8s.smoke diff --git a/etc/conf/bottlenecks_config.yml b/etc/conf/bottlenecks_config.yml index c44047fd..5866aa3a 100644 --- a/etc/conf/bottlenecks_config.yml +++ b/etc/conf/bottlenecks_config.yml @@ -4,29 +4,45 @@ {% set testcase = testcase or '' %} {% set deploy_scenario = deploy_scenario or 'unknown' %} {% set dovetail_home = dovetail_home or '' %} +{% set debug = debug or 'false' %} +{% set build_tag = build_tag or '' %} +{% set cacert_volume = '' %} +{% if cacert %} + {% set cacert_volume = ' -v ' + cacert + ':' + cacert %} +{% endif %} +{% set openrc_file = '/tmp/admin_rc.sh' %} +{% set result_dir = '/home/opnfv/bottlenecks/results' %} +{% set config_dir = '/home/opnfv/userconfig' %} +{% set image_file = '/tmp/yardstick.img' %} bottlenecks: image_name: opnfv/bottlenecks docker_tag: latest opts: '-id --privileged=true' - envs: '-e DEPLOY_SCENARIO={{deploy_scenario}} -e Yardstick_TAG=stable -e OUTPUT_FILE={{testcase}}.out' + envs: '-e DEPLOY_SCENARIO={{deploy_scenario}} -e Yardstick_TAG=stable + -e OUTPUT_FILE={{testcase}}.out -e CI_DEBUG={{debug}} + -e BUILD_TAG={{build_tag}}-{{testcase}}' volumes: - '-v /var/run/docker.sock:/var/run/docker.sock' - '-v {{dovetail_home}}/results/bottlenecks:/tmp' + - '-v {{dovetail_home}}/pre_config/env_config.sh:{{openrc_file}}' + - {{cacert_volume}} + - '-v {{dovetail_home}}:{{config_dir}}' + - '-v {{dovetail_home}}/results:{{result_dir}}' config: - dir: '/home/opnfv/userconfig' + dir: {{config_dir}} pre_condition: - - 'cp /home/opnfv/userconfig/images/ubuntu-16.04-server-cloudimg-amd64-disk1.img /tmp/yardstick.img' + - 'cp {{config_dir}}/images/ubuntu-16.04-server-cloudimg-amd64-disk1.img {{image_file}}' cmds: - 'python /home/opnfv/bottlenecks/testsuites/run_testsuite.py testcase {{validate_testcase}} False' post_condition: - - 'mkdir -p /home/opnfv/bottlenecks/results' - - 'cp /tmp/bottlenecks.log /home/opnfv/bottlenecks/results' - - 'cp /tmp/bottlenecks.stress.ping.out /home/opnfv/bottlenecks/results' - - 'rm /tmp/yardstick.img' + - 'mkdir -p {{result_dir}}' + - 'cp /tmp/bottlenecks.log {{result_dir}}' + - 'cp /tmp/bottlenecks.stress.ping.out {{result_dir}}' + - 'rm {{image_file}}' result: - dir: '/home/opnfv/bottlenecks/results' - openrc: '/tmp/admin_rc.sh' + dir: {{result_dir}} + openrc: {{openrc_file}} extra_container: - 'Bottlenecks-Yardstick' - 'Bottlenecks-ELK' diff --git a/etc/conf/dovetail_config.yml b/etc/conf/dovetail_config.yml index ca36fe55..ed6433b9 100644 --- a/etc/conf/dovetail_config.yml +++ b/etc/conf/dovetail_config.yml @@ -31,6 +31,7 @@ testarea_supported: - tempest - vnf - vping + - k8s # used for testcase cmd template in jinja2 format # we have two variables available now diff --git a/etc/conf/functest-k8s_config.yml b/etc/conf/functest-k8s_config.yml new file mode 100644 index 00000000..e717ef94 --- /dev/null +++ b/etc/conf/functest-k8s_config.yml @@ -0,0 +1,31 @@ +--- + +{% set validate_testcase = validate_testcase or '' %} +{% set testcase = testcase or '' %} +{% set dovetail_home = dovetail_home or '' %} +{% set debug = debug or 'false' %} +{% set build_tag = build_tag or '' %} +{% set openrc_file = '/home/opnfv/functest/conf/env_file' %} +{% set kube_file = '/root/.kube/config' %} +{% set result_dir = '/home/opnfv/functest/results' %} + +functest-k8s: + image_name: opnfv/functest-kubernetes-healthcheck + docker_tag: gambia + opts: '-id' + envs: '-e INSTALLER_TYPE=unknown -e DEPLOY_SCENARIO=k8-deploy -e NODE_NAME=unknown + -e TEST_DB_URL=file:///home/opnfv/functest/results/functest_results.txt + -e CI_DEBUG={{debug}} -e BUILD_TAG={{build_tag}}-{{testcase}}' + volumes: + - '-v {{dovetail_home}}/pre_config/k8.creds:{{openrc_file}}' + - '-v {{dovetail_home}}/pre_config/admin.conf:{{kube_file}}' + - '-v {{dovetail_home}}/results/:{{result_dir}}' + pre_condition: + - 'echo test for precondition in functest' + cmds: + - 'run_tests -t {{validate_testcase}} -r' + post_condition: + - 'echo test for postcondition in functest' + result: + dir: {{result_dir}} + openrc: {{openrc_file}} diff --git a/etc/conf/functest_config.yml b/etc/conf/functest_config.yml index 631e832a..451b1675 100644 --- a/etc/conf/functest_config.yml +++ b/etc/conf/functest_config.yml @@ -1,22 +1,40 @@ --- {% set validate_testcase = validate_testcase or '' %} +{% set testcase = testcase or '' %} {% set deploy_scenario = deploy_scenario or 'unknown' %} {% set os_insecure = os_insecure or 'False' %} {% set os_verify = '' %} {% if os_insecure == 'True' %} {% set os_verify = ' -e OS_VERIFY= ' %} {% endif %} +{% set dovetail_home = dovetail_home or '' %} +{% set debug = debug or 'false' %} +{% set build_tag = build_tag or '' %} +{% set cacert_volume = '' %} +{% if cacert %} + {% set cacert_volume = ' -v ' + cacert + ':' + cacert %} +{% endif %} +{% set openrc_file = '/home/opnfv/functest/conf/env_file' %} +{% set result_dir = '/home/opnfv/functest/results' %} +{% set config_dir = '/home/opnfv/userconfig' %} +{% set images_dir = '/home/opnfv/functest/images' %} functest: image_name: opnfv/functest-smoke docker_tag: gambia opts: '-id --privileged=true' envs: '{{os_verify}} -e INSTALLER_TYPE=unknown -e DEPLOY_SCENARIO={{deploy_scenario}} -e NODE_NAME=unknown - -e TEST_DB_URL=file:///home/opnfv/functest/results/functest_results.txt' + -e TEST_DB_URL=file://{{result_dir}}/functest_results.txt + -e CI_DEBUG={{debug}} -e BUILD_TAG={{build_tag}}-{{testcase}}' + volumes: + - '-v {{dovetail_home}}/pre_config/env_config.sh:{{openrc_file}}' + - {{cacert_volume}} + - '-v {{dovetail_home}}:{{config_dir}}' + - '-v {{dovetail_home}}/results:{{result_dir}}' + - '-v {{dovetail_home}}/images:{{images_dir}}' config: - dir: '/home/opnfv/userconfig' - images: '/home/opnfv/functest/images' + dir: {{config_dir}} pre_condition: - 'echo test for precondition in functest' cmds: @@ -24,5 +42,5 @@ functest: post_condition: - 'echo test for postcondition in functest' result: - dir: '/home/opnfv/functest/results' - openrc: '/home/opnfv/functest/conf/env_file' + dir: {{result_dir}} + openrc: {{openrc_file}} diff --git a/etc/conf/yardstick_config.yml b/etc/conf/yardstick_config.yml index 10436658..764ca94b 100644 --- a/etc/conf/yardstick_config.yml +++ b/etc/conf/yardstick_config.yml @@ -9,25 +9,41 @@ {% if os_insecure == 'True' %} {% set os_verify = ' -e OS_VERIFY= ' %} {% endif %} +{% set dovetail_home = dovetail_home or '' %} +{% set debug = debug or 'false' %} +{% set build_tag = build_tag or '' %} +{% set cacert_volume = '' %} +{% if cacert %} + {% set cacert_volume = ' -v ' + cacert + ':' + cacert %} +{% endif %} +{% set openrc_file = '/etc/yardstick/openstack.creds' %} +{% set result_dir = '/tmp/yardstick' %} +{% set config_dir = '/home/opnfv/userconfig' %} yardstick: image_name: opnfv/yardstick docker_tag: latest opts: '-id --privileged=true' - envs: "{{os_verify}} -e YARDSTICK_BRANCH=fraser" + envs: "{{os_verify}} -e YARDSTICK_BRANCH=fraser -e CI_DEBUG={{debug}} + -e BUILD_TAG={{build_tag}}-{{testcase}}" + volumes: + - '-v {{dovetail_home}}/pre_config/env_config.sh:{{openrc_file}}' + - {{cacert_volume}} + - '-v {{dovetail_home}}:{{config_dir}}' + - '-v {{dovetail_home}}/results:{{result_dir}}' config: - dir: '/home/opnfv/userconfig' + dir: {{config_dir}} pre_condition: - 'echo this is pre_condition' cmds: - - "cd /home/opnfv/repos/yardstick && source /etc/yardstick/openstack.creds && + - "cd /home/opnfv/repos/yardstick && source {{openrc_file}} && yardstick task start tests/opnfv/test_cases/{{validate_testcase}}.yaml - --output-file /tmp/yardstick/{{testcase}}.out - --task-args '{'file': '/home/opnfv/userconfig/pre_config/pod.yaml', + --output-file {{result_dir}}/{{testcase}}.out + --task-args '{'file': '{{config_dir}}/pre_config/pod.yaml', 'attack_host': {{attack_host}}, 'attack_process': {{attack_process}}}'" post_condition: - 'echo this is post_condition' result: - dir: '/tmp/yardstick' - openrc: '/etc/yardstick/openstack.creds' + dir: {{result_dir}} + openrc: {{openrc_file}} diff --git a/etc/testcase/functest.k8s.conformance.yml b/etc/testcase/functest.k8s.conformance.yml new file mode 100644 index 00000000..db85342c --- /dev/null +++ b/etc/testcase/functest.k8s.conformance.yml @@ -0,0 +1,15 @@ +--- +functest.k8s.conformance: + name: functest.k8s.conformance + objective: Validate the deployed k8s cluster is conformance. + validate: + type: functest-k8s + testcase: k8s_conformance + image_name: opnfv/functest-kubernetes-smoke + report: + source_archive_files: + - functest-kubernetes.log + dest_archive_files: + - k8s_logs/functest.k8s.conformance.log + check_results_file: 'functest_results.txt' + sub_testcase_list: diff --git a/etc/testcase/functest.k8s.smoke.yml b/etc/testcase/functest.k8s.smoke.yml new file mode 100644 index 00000000..cedc0223 --- /dev/null +++ b/etc/testcase/functest.k8s.smoke.yml @@ -0,0 +1,15 @@ +--- +functest.k8s.smoke: + name: functest.k8s.smoke + objective: Validate the deployed k8s cluster is accessible. + validate: + type: functest-k8s + testcase: k8s_smoke + image_name: opnfv/functest-kubernetes-healthcheck + report: + source_archive_files: + - functest-kubernetes.log + dest_archive_files: + - k8s_logs/functest.k8s.smoke.log + check_results_file: 'functest_results.txt' + sub_testcase_list: -- cgit 1.2.3-korg