From f451dc1eb707f49c8ee75d4a8c6a40527ebe6dcc Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Thu, 3 Sep 2020 11:43:28 +0200 Subject: [PATCH] build: run_regression_tests.sh skip packages tests if asked Co-Authored-By: Leonardo Grasso Signed-off-by: Lorenzo Fontana --- .circleci/config.yml | 1 + docker/tester/root/usr/bin/entrypoint | 19 ++++++++++++------- test/run_regression_tests.sh | 9 ++++++++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b98822aac7..2b33e73fefc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -249,6 +249,7 @@ jobs: SOURCE_DIR: "/source-static" BUILD_DIR: "/build-static" BUILD_TYPE: "release" + SKIP_PACKAGES_TESTS: "true" steps: - setup_remote_docker - attach_workspace: diff --git a/docker/tester/root/usr/bin/entrypoint b/docker/tester/root/usr/bin/entrypoint index fb145a80727..4d975b6007f 100755 --- a/docker/tester/root/usr/bin/entrypoint +++ b/docker/tester/root/usr/bin/entrypoint @@ -4,6 +4,7 @@ set -u -o pipefail BUILD_DIR=${BUILD_DIR:-/build} SOURCE_DIR=${SOURCE_DIR:-/source} +SKIP_PACKAGES_TESTS=${SKIP_PACKAGES_TESTS:-false} CMD=${1:-test} shift @@ -57,9 +58,11 @@ case "$CMD" in fi # build docker images - build_image "$BUILD_DIR" "$BUILD_TYPE" "$FALCO_VERSION" "deb" - build_image "$BUILD_DIR" "$BUILD_TYPE" "$FALCO_VERSION" "rpm" - build_image "$BUILD_DIR" "$BUILD_TYPE" "$FALCO_VERSION" "tar.gz" + if [ "$SKIP_PACKAGES_TESTS" = false ] ; then + build_image "$BUILD_DIR" "$BUILD_TYPE" "$FALCO_VERSION" "deb" + build_image "$BUILD_DIR" "$BUILD_TYPE" "$FALCO_VERSION" "rpm" + build_image "$BUILD_DIR" "$BUILD_TYPE" "$FALCO_VERSION" "tar.gz" + fi # check that source directory contains Falco if [ ! -d "$SOURCE_DIR/falco/test" ]; then @@ -70,12 +73,14 @@ case "$CMD" in # run tests echo "Running regression tests ..." cd "$SOURCE_DIR/falco/test" - ./run_regression_tests.sh -d "$BUILD_DIR/$BUILD_TYPE" + SKIP_PACKAGES_TESTS=$SKIP_PACKAGES_TESTS ./run_regression_tests.sh -d "$BUILD_DIR/$BUILD_TYPE" # clean docker images - clean_image "deb" - clean_image "rpm" - clean_image "tar.gz" + if [ "$SKIP_PACKAGES_TESTS" = false ] ; then + clean_image "deb" + clean_image "rpm" + clean_image "tar.gz" + fi ;; "bash") CMD=/bin/bash diff --git a/test/run_regression_tests.sh b/test/run_regression_tests.sh index cfebacda8b1..b2931835d87 100755 --- a/test/run_regression_tests.sh +++ b/test/run_regression_tests.sh @@ -19,6 +19,7 @@ set -euo pipefail SCRIPT=$(readlink -f $0) SCRIPTDIR=$(dirname "$SCRIPT") +SKIP_PACKAGES_TESTS=${SKIP_PACKAGES_TESTS:-false} function download_trace_files() { for TRACE in traces-positive traces-negative traces-info ; do @@ -91,7 +92,13 @@ function run_tests() { # as we're watching the return status when running avocado. set +e TEST_RC=0 - for mult in $SCRIPTDIR/falco_traces.yaml $SCRIPTDIR/falco_tests.yaml $SCRIPTDIR/falco_tests_package.yaml $SCRIPTDIR/falco_k8s_audit_tests.yaml $SCRIPTDIR/falco_tests_psp.yaml; do + suites=($SCRIPTDIR/falco_traces.yaml $SCRIPTDIR/falco_tests.yaml $SCRIPTDIR/falco_k8s_audit_tests.yaml $SCRIPTDIR/falco_tests_psp.yaml) + + if [ "$SKIP_PACKAGES_TESTS" = false ] ; then + suites+=($SCRIPTDIR/falco_tests_package.yaml) + fi + + for mult in "${suites[@]}"; do CMD="avocado run --mux-yaml $mult --job-results-dir $SCRIPTDIR/job-results -- $SCRIPTDIR/falco_test.py" echo "Running $CMD" BUILD_DIR=${OPT_BUILD_DIR} $CMD