From e30a703c8e247c1209deb6530d1660d4f9658f36 Mon Sep 17 00:00:00 2001 From: Maxime Guyot Date: Mon, 27 May 2019 14:31:52 +0200 Subject: [PATCH] Add Kubernetes conformance tests (#4614) --- tests/files/tf-ovh_ubuntu18-calico.yml | 1 + tests/scripts/testcases_run.sh | 3 ++ tests/testcases/100_check-k8s-conformance.yml | 37 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 tests/testcases/100_check-k8s-conformance.yml diff --git a/tests/files/tf-ovh_ubuntu18-calico.yml b/tests/files/tf-ovh_ubuntu18-calico.yml index 5313d0201..daebfd1be 100644 --- a/tests/files/tf-ovh_ubuntu18-calico.yml +++ b/tests/files/tf-ovh_ubuntu18-calico.yml @@ -1,3 +1,4 @@ --- dns_min_replicas: 1 deploy_netchecker: true +sonobuoy_enabled: true diff --git a/tests/scripts/testcases_run.sh b/tests/scripts/testcases_run.sh index 3cae1a4a4..015e5c880 100755 --- a/tests/scripts/testcases_run.sh +++ b/tests/scripts/testcases_run.sh @@ -45,6 +45,9 @@ ansible-playbook -e ansible_python_interpreter=${PYPATH} --limit "all:!fake_host ## Advanced DNS checks ansible-playbook -e ansible_python_interpreter=${PYPATH} --limit "all:!fake_hosts" tests/testcases/040_check-network-adv.yml $LOG_LEVEL +## Kubernetes conformance tests +ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -e @${CI_TEST_VARS} --limit "all:!fake_hosts" tests/testcases/100_check-k8s-conformance.yml $LOG_LEVEL + ## Idempotency checks 1/5 (repeat deployment) if [ "${IDEMPOT_CHECK}" = "true" ]; then ansible-playbook ${LOG_LEVEL} -e @${CI_TEST_VARS} -e ansible_python_interpreter=${PYPATH} -e local_release_dir=${PWD}/downloads --limit "all:!fake_hosts" cluster.yml diff --git a/tests/testcases/100_check-k8s-conformance.yml b/tests/testcases/100_check-k8s-conformance.yml new file mode 100644 index 000000000..18c2a8d2b --- /dev/null +++ b/tests/testcases/100_check-k8s-conformance.yml @@ -0,0 +1,37 @@ +--- +- hosts: kube-master[0] + vars: + sonobuoy_version: 0.14.1 + sonobuoy_arch: amd64 + sonobuoy_parallel: 30 + sonobuoy_path: /usr/local/bin/sonobuoy + sonobuoy_skip: 'Alpha|Disruptive|Feature|Flaky|Slow|Serial' + sonobuoy_mode: Quick + + tasks: + - name: Run sonobuoy + when: + - sonobuoy_enabled is defined + - sonobuoy_enabled + block: + - name: Download sonobuoy + get_url: + url: "https://github.com/heptio/sonobuoy/releases/download/v{{ sonobuoy_version }}/sonobuoy_{{ sonobuoy_version }}_linux_{{ sonobuoy_arch }}.tar.gz" + dest: /tmp/sonobuoy.tar.gz + + - name: Extract sonobuoy + unarchive: + src: /tmp/sonobuoy.tar.gz + dest: /usr/local/bin/ + copy: no + + - name: Run sonobuoy + command: "{{ sonobuoy_path }} run --mode {{ sonobuoy_mode }} --e2e-parallel {{ sonobuoy_parallel }} --e2e-skip {{ sonobuoy_skip }} --wait" + when: sonobuoy_enabled | default(false) + + - name: Run sonobuoy retrieve + command: "{{ sonobuoy_path }} retrieve" + register: sonobuoy_retrieve + + - name: Run inspect results + command: "{{ sonobuoy_path }} e2e {{ sonobuoy_retrieve.stdout }}"