From 51422387a92323a678b1f761d25ef19b9c55913c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Thu, 31 Jan 2019 11:30:34 +0100 Subject: [PATCH] see #31: split the CI tests in multiple jobs so that Travis builds do not timeout --- .travis.yml | 12 ++++++++++-- tests/3scale-inventory.yaml.enc | Bin 2256 -> 1168 bytes tests/inventory.j2 | 10 ++++++---- tests/results/.gitignore | 1 + tests/run-tests.sh | 16 +++++++++++++--- 5 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 tests/results/.gitignore diff --git a/.travis.yml b/.travis.yml index 3b447be..c85a4af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,17 @@ language: python matrix: include: - python: '2.7' - env: ANSIBLE_VERSION=2.4.6 THREESCALE_POOL=0 + env: ANSIBLE_VERSION=2.4.6 THREESCALE_ENV=saas + - python: '2.7' + env: ANSIBLE_VERSION=2.4.6 THREESCALE_ENV=saas-apicast-self-managed + - python: '2.7' + env: ANSIBLE_VERSION=2.4.6 THREESCALE_ENV=onpremise-2.3 + - python: '3.6' + env: ANSIBLE_VERSION=2.7.5 THREESCALE_ENV=saas + - python: '3.6' + env: ANSIBLE_VERSION=2.7.5 THREESCALE_ENV=saas-apicast-self-managed - python: '3.6' - env: ANSIBLE_VERSION=2.7.5 THREESCALE_POOL=1 + env: ANSIBLE_VERSION=2.7.5 THREESCALE_ENV=onpremise-2.3 install: - pip install ansible==$ANSIBLE_VERSION - pip install jmespath diff --git a/tests/3scale-inventory.yaml.enc b/tests/3scale-inventory.yaml.enc index 032a4d713ae4ce3ac7b82bb9676bd6474d1aa7d9..390d2e5f0f8e346a7c4cf17543253f134db8358f 100644 GIT binary patch literal 1168 zcmV;B1aJE>%X7lmH({D$+R9c=6+zQT|W>RPlhkFY}L(pECfofS|rB_14KLNs-XI6I#k^^^ID zB-@eZNj~f;Apipyp8{px?&O$#DEV-3)3pEedG>oOCB|c*{~h+{zr7SRCp6wQT__g7{it9(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m2nEy{6T!XHTohCM*?J*x(^#+(1~F)^-|tzHrbC+6o;N7%52Q*HZ}Wt zZDJaHlI^%sT2aanhWkxfP3b~{cd_NG%Y}5fxZ92{dfdase^Qq{h=ionjG%*v=)#xy zNLMDVt@{O(5ok?zaY@f1(if^i$H@}Q;TZxfS9nU;%{Q;ehe#Pe^zkrTuYMUUTdX2% z!Mr*4_L&vu5IC3AyqhIG1pOr^0+>6_2l%n-h@G(eVgdwsQFi6Y&4K%CgdGvvr$LN7`pDq5*u zq!7UEWgXvWdrV=TIi@j(o8@p^o;jv%PrZ{sgVk(kAJZTp>sX$|@n81mQO|>STg{ zl=Cipq=fnd)uE(^OEiEqm;K@*t3nfD!))jao*3{9^iYC0?i_~;_Krpt zWiJ(*7*P@hPV|v>3rPs4Qdhpc$?JeSv4yVzJUo=0s$nT;I)hjQA=8>3;C69Li4X_5UK zZpW1S5v5{RLY`v&~RgZ2lkmzQY==@Qegh@1*INr7EE8iyJe}o eS0ET!_s#e%YfX_-8eBX^&TPj^stVJ@DOaYmb%C(} diff --git a/tests/inventory.j2 b/tests/inventory.j2 index 5176629..037c3a7 100644 --- a/tests/inventory.j2 +++ b/tests/inventory.j2 @@ -1,7 +1,3 @@ -{# Select the target CI platform using the THREESCALE_POOL environment variable #} -{% set pool = lookup('env', 'THREESCALE_POOL') %} -{% set test_environment = test_environment[pool|int] %} - [all:vars] ansible_connection=local @@ -22,3 +18,9 @@ threescale_cicd_apicast_sandbox_endpoint='{% raw %}{{ threescale_cicd_default_ap {% if 'apicast_production_domain' in test_environment.threescale %} threescale_cicd_apicast_production_endpoint='{% raw %}{{ threescale_cicd_default_apicast_scheme }}://{{ ((threescale_cicd_api_environment_name ~ "-" if threescale_cicd_api_environment_name is defined else "") ~ threescale_cicd_api_system_name)|regex_replace("[^a-zA-Z0-9-]+", "-")|lower }}{{ threescale_cicd_default_production_suffix }}{% endraw %}.{{ test_environment.threescale.apicast_production_domain }}' {% endif %} +{% if test_environment.threescale.admin_portal is match(".*[.]3scale[.]net") %} +# The 3scale SaaS environment is sometimes slow. Make sure to give enough time +# to the SaaS environment to synchronise the OIDC clients in RH-SSO. +threescale_cicd_delay=15 +threescale_cicd_retries=200 +{% endif %} diff --git a/tests/results/.gitignore b/tests/results/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/tests/results/.gitignore @@ -0,0 +1 @@ +* diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 09aa388..483b525 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -1,10 +1,14 @@ #!/bin/bash +# Make sure all Ansible failed tasks go to the stderr. Failed tasks usually +# output sensitive informations, by routing them to stderr we can filter +# them out. +export ANSIBLE_DISPLAY_FAILED_STDERR=yes cd "${0%/*}" || exit 1 echo "--> Generating the Ansible inventory files..." -ansible-playbook -i /dev/null write-inventory-files.yml +ansible-playbook -i /dev/null write-inventory-files.yml &>results/write-inventory-files ret=$? if [ "$ret" -gt 0 ]; then echo "--> Ansible inventory files generation FAILED !" @@ -23,10 +27,16 @@ fi # cd ".." || exit 1 -for environment in tests/environments/3scale-*; do +for environment in tests/environments/3scale-${THREESCALE_ENV:-*}; do for testcase in tests/test-cases/*.y*ml; do echo "--> Running $testcase against $environment..." - ansible-playbook -i "$environment" -v "$testcase" + if [ -z "$THREESCALE_VERBOSE" ] || [ "$THREESCALE_VERBOSE" == "no" ]; then + # reduce output verbosity and make sure not to output sensitive information + logfile="tests/results/$(basename "$environment")-$(basename "$testcase")" + DISPLAY_SKIPPED_HOSTS=no ANSIBLE_DISPLAY_OK_HOSTS=no ansible-playbook -i "$environment" "$testcase" 2>"$logfile" + else + ansible-playbook -i "$environment" -v "$testcase" + fi ret=$? if [ "$ret" -gt 0 ]; then echo "--> $testcase against $environment FAILED !"