From 1424edc206b9b4a1c094662e702110708ac4f03e Mon Sep 17 00:00:00 2001 From: Dmitriy Paunin Date: Fri, 1 Jun 2018 09:48:02 +0700 Subject: [PATCH] ISSUE-164 (#165) ISSUE-164 Split tests runs and run only one test in one travis job --- .travis.yml | 78 ++++++++++++++--------------- make/make.sh | 21 +++++--- make/travis/make.sh | 7 +-- src/includes/travis/header.part.yml | 5 ++ src/includes/travis/travis.part.yml | 9 +--- tests/README.md | 1 + tests/run.sh | 10 +++- 7 files changed, 72 insertions(+), 59 deletions(-) create mode 100644 src/includes/travis/header.part.yml diff --git a/.travis.yml b/.travis.yml index 82114840..dd8bc274 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,124 +1,122 @@ ########################################################################## ## AUTO-GENERATED FILE ## -## BUILD_NUMBER=Mon May 28 16:58:37 +07 2018 ## +## BUILD_NUMBER=Thu May 31 15:23:48 +07 2018 ## ########################################################################## sudo: required - services: - docker - jobs: include: - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.6_pgpool-3.7_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-9.6_pgpool-3.7_barman-2.4 + - COMBINATION=postgres-extended-9.6_pgpool-3.7_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.6_pgpool-3.7_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-9.6_pgpool-3.7_barman-2.3 + - COMBINATION=postgres-extended-9.6_pgpool-3.7_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.6_pgpool-3.6_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-9.6_pgpool-3.6_barman-2.4 + - COMBINATION=postgres-extended-9.6_pgpool-3.6_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.6_pgpool-3.6_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-9.6_pgpool-3.6_barman-2.3 + - COMBINATION=postgres-extended-9.6_pgpool-3.6_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.6_pgpool-3.3_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-9.6_pgpool-3.3_barman-2.4 + - COMBINATION=postgres-extended-9.6_pgpool-3.3_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.6_pgpool-3.3_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-9.6_pgpool-3.3_barman-2.3 + - COMBINATION=postgres-extended-9.6_pgpool-3.3_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.5_pgpool-3.7_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-9.5_pgpool-3.7_barman-2.4 + - COMBINATION=postgres-extended-9.5_pgpool-3.7_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.5_pgpool-3.7_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-9.5_pgpool-3.7_barman-2.3 + - COMBINATION=postgres-extended-9.5_pgpool-3.7_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.5_pgpool-3.6_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-9.5_pgpool-3.6_barman-2.4 + - COMBINATION=postgres-extended-9.5_pgpool-3.6_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.5_pgpool-3.6_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-9.5_pgpool-3.6_barman-2.3 + - COMBINATION=postgres-extended-9.5_pgpool-3.6_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.5_pgpool-3.3_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-9.5_pgpool-3.3_barman-2.4 + - COMBINATION=postgres-extended-9.5_pgpool-3.3_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-9.5_pgpool-3.3_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-9.5_pgpool-3.3_barman-2.3 + - COMBINATION=postgres-extended-9.5_pgpool-3.3_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-10_pgpool-3.7_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-10_pgpool-3.7_barman-2.4 + - COMBINATION=postgres-extended-10_pgpool-3.7_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-10_pgpool-3.7_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-10_pgpool-3.7_barman-2.3 + - COMBINATION=postgres-extended-10_pgpool-3.7_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-10_pgpool-3.6_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-10_pgpool-3.6_barman-2.4 + - COMBINATION=postgres-extended-10_pgpool-3.6_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-10_pgpool-3.6_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-10_pgpool-3.6_barman-2.3 + - COMBINATION=postgres-extended-10_pgpool-3.6_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-10_pgpool-3.3_barman-2.4 ./tests/run.sh env: - - NAME = postgres-extended-10_pgpool-3.3_barman-2.4 + - COMBINATION=postgres-extended-10_pgpool-3.3_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-extended-10_pgpool-3.3_barman-2.3 ./tests/run.sh env: - - NAME = postgres-extended-10_pgpool-3.3_barman-2.3 + - COMBINATION=postgres-extended-10_pgpool-3.3_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.6_pgpool-3.7_barman-2.4 ./tests/run.sh env: - - NAME = postgres-9.6_pgpool-3.7_barman-2.4 + - COMBINATION=postgres-9.6_pgpool-3.7_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.6_pgpool-3.7_barman-2.3 ./tests/run.sh env: - - NAME = postgres-9.6_pgpool-3.7_barman-2.3 + - COMBINATION=postgres-9.6_pgpool-3.7_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.6_pgpool-3.6_barman-2.4 ./tests/run.sh env: - - NAME = postgres-9.6_pgpool-3.6_barman-2.4 + - COMBINATION=postgres-9.6_pgpool-3.6_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.6_pgpool-3.6_barman-2.3 ./tests/run.sh env: - - NAME = postgres-9.6_pgpool-3.6_barman-2.3 + - COMBINATION=postgres-9.6_pgpool-3.6_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.6_pgpool-3.3_barman-2.4 ./tests/run.sh env: - - NAME = postgres-9.6_pgpool-3.3_barman-2.4 + - COMBINATION=postgres-9.6_pgpool-3.3_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.6_pgpool-3.3_barman-2.3 ./tests/run.sh env: - - NAME = postgres-9.6_pgpool-3.3_barman-2.3 + - COMBINATION=postgres-9.6_pgpool-3.3_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.5_pgpool-3.7_barman-2.4 ./tests/run.sh env: - - NAME = postgres-9.5_pgpool-3.7_barman-2.4 + - COMBINATION=postgres-9.5_pgpool-3.7_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.5_pgpool-3.7_barman-2.3 ./tests/run.sh env: - - NAME = postgres-9.5_pgpool-3.7_barman-2.3 + - COMBINATION=postgres-9.5_pgpool-3.7_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.5_pgpool-3.6_barman-2.4 ./tests/run.sh env: - - NAME = postgres-9.5_pgpool-3.6_barman-2.4 + - COMBINATION=postgres-9.5_pgpool-3.6_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.5_pgpool-3.6_barman-2.3 ./tests/run.sh env: - - NAME = postgres-9.5_pgpool-3.6_barman-2.3 + - COMBINATION=postgres-9.5_pgpool-3.6_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.5_pgpool-3.3_barman-2.4 ./tests/run.sh env: - - NAME = postgres-9.5_pgpool-3.3_barman-2.4 + - COMBINATION=postgres-9.5_pgpool-3.3_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-9.5_pgpool-3.3_barman-2.3 ./tests/run.sh env: - - NAME = postgres-9.5_pgpool-3.3_barman-2.3 + - COMBINATION=postgres-9.5_pgpool-3.3_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-10_pgpool-3.7_barman-2.4 ./tests/run.sh env: - - NAME = postgres-10_pgpool-3.7_barman-2.4 + - COMBINATION=postgres-10_pgpool-3.7_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-10_pgpool-3.7_barman-2.3 ./tests/run.sh env: - - NAME = postgres-10_pgpool-3.7_barman-2.3 + - COMBINATION=postgres-10_pgpool-3.7_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-10_pgpool-3.6_barman-2.4 ./tests/run.sh env: - - NAME = postgres-10_pgpool-3.6_barman-2.4 + - COMBINATION=postgres-10_pgpool-3.6_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-10_pgpool-3.6_barman-2.3 ./tests/run.sh env: - - NAME = postgres-10_pgpool-3.6_barman-2.3 + - COMBINATION=postgres-10_pgpool-3.6_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-10_pgpool-3.3_barman-2.4 ./tests/run.sh env: - - NAME = postgres-10_pgpool-3.3_barman-2.4 + - COMBINATION=postgres-10_pgpool-3.3_barman-2.4 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=postgres-10_pgpool-3.3_barman-2.3 ./tests/run.sh env: - - NAME = postgres-10_pgpool-3.3_barman-2.3 + - COMBINATION=postgres-10_pgpool-3.3_barman-2.3 - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS=latest ./tests/run.sh env: - - NAME = latest + - COMBINATION=latest diff --git a/make/make.sh b/make/make.sh index 4f256b93..c432f6bb 100755 --- a/make/make.sh +++ b/make/make.sh @@ -2,6 +2,7 @@ set -e BUILD_NUMBER=`date` +SYSTEM_TO_MAKE="$1" function flush { MARKER_LINE="BUILD_NUMBER=$BUILD_NUMBER" @@ -21,8 +22,12 @@ function template { TEMPLATE_FILE_TO="$2" CONFIGS="${@:3}" flush $TEMPLATE_FILE_TO - - echo ">>>>>> $CONFIGS" + echo -n ">>>>>> " + if [ "$CONFIGS" == "" ];then + echo "(no configs)" + else + echo "CONFIGS: $CONFIGS" + fi eval "$CONFIGS" mo $TEMPLATE_FILE_FROM >> $TEMPLATE_FILE_TO } @@ -35,8 +40,12 @@ if [ ! -f "tmp/mo" ]; then fi . ./tmp/mo -# Making -for SYSTEM in `find ./make/* -maxdepth 1 -type d`; do - echo "> Processing $SYSTEM" - source $SYSTEM/make.sh +for SYSTEM_PATH in `find ./make/* -maxdepth 1 -type d`; do + SYSTEM=`basename $SYSTEM_PATH` + if [ "$SYSTEM_TO_MAKE" != "" ] && [ "$SYSTEM_TO_MAKE" != "$SYSTEM" ]; then + echo "> Skipping $SYSTEM as it's not required to build (SYSTEM_TO_MAKE=$SYSTEM_TO_MAKE)" + continue + fi + echo "> Making $SYSTEM ($SYSTEM_PATH)" + source $SYSTEM_PATH/make.sh done diff --git a/make/travis/make.sh b/make/travis/make.sh index 96e95911..2ac13980 100644 --- a/make/travis/make.sh +++ b/make/travis/make.sh @@ -1,9 +1,10 @@ echo ">>> Making travis" FILE_FROM="./src/includes/travis/travis.part.yml" +FILE_HEADER="./src/includes/travis/header.part.yml" FILE_TO=".travis.yml" -export TEST_COMBINATIONS=(`ls -r docker-compose | grep '.yml' | xargs -I % basename % '.yml'`) -template $FILE_FROM $FILE_TO - +template $FILE_HEADER $FILE_TO +export TEST_COMBINATIONS=(`ls -r docker-compose | grep '.yml' | xargs -I % basename % '.yml'`) +template $FILE_FROM $FILE_TO diff --git a/src/includes/travis/header.part.yml b/src/includes/travis/header.part.yml new file mode 100644 index 00000000..cf936345 --- /dev/null +++ b/src/includes/travis/header.part.yml @@ -0,0 +1,5 @@ +sudo: required +services: + - docker +jobs: + include: diff --git a/src/includes/travis/travis.part.yml b/src/includes/travis/travis.part.yml index 7b46bd86..7fc16b2b 100644 --- a/src/includes/travis/travis.part.yml +++ b/src/includes/travis/travis.part.yml @@ -1,12 +1,5 @@ -sudo: required - -services: - - docker - -jobs: - include: {{#TEST_COMBINATIONS}} - script: NO_COLOURS=1 DEBUG=1 TEST_COMBINATIONS={{.}} ./tests/run.sh env: - - NAME = {{.}} + - COMBINATION={{.}} {{/TEST_COMBINATIONS}} \ No newline at end of file diff --git a/tests/README.md b/tests/README.md index c64bcab1..ea2d6a22 100644 --- a/tests/README.md +++ b/tests/README.md @@ -16,6 +16,7 @@ Some binary ENV variables for tests runner(By default everything is `0`, you can * `NO_COLOURS` - disable fancy coloured output * `DEBUG` - will output everything from tests scripts * `NO_CLEANUP` - will not destroy `docker-compose` environment after each test +* `SKIP_BUILD` - allow to avoid rebuilding of all images for tests on start (required images would be built on test run anyways ) ## How to create a new test diff --git a/tests/run.sh b/tests/run.sh index bddc3258..6babc1ef 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -31,8 +31,14 @@ for TEST_COMBINATION in $TEST_COMBINATIONS; do TESTS_SKIPPED=$((TESTS_SKIPPED+1)) fi export COMPOSE_FILE - echo ">>> Preparing environment:" - docker-compose down -v && docker-compose build --no-cache > /dev/null + + if [ "$SKIP_BUILD" == "1" ]; then + echo ">>> Skipping environment preparation! (SKIP_BUILD=$SKIP_BUILD)" + else + echo ">>> Preparing environment:" + docker-compose down -v && docker-compose build --no-cache > /dev/null + fi + for TEST in $TESTS; do echo -n ">>> Running test $TEST:"