Skip to content

Commit

Permalink
feat_: UNIT_TEST_DRY_RUN flag for tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-sirotin committed Sep 2, 2024
1 parent 7919ec3 commit 4c9ff3f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ docker-test: ##@tests Run tests in a docker container with golang.
test: test-unit ##@tests Run basic, short tests during development

test-unit: export BUILD_TAGS ?=
test-unit: export UNIT_TEST_DRY_RUN ?= false
test-unit: export UNIT_TEST_COUNT ?= 1
test-unit: export UNIT_TEST_FAILFAST ?= true
test-unit: export UNIT_TEST_RERUN_FAILS ?= true
Expand Down
6 changes: 6 additions & 0 deletions _assets/ci/Jenkinsfile.tests
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ pipeline {
defaultValue: true,
description: 'Should the job report test coverage to CodeClimate?'
)
booleanParam(
name: 'UNIT_TEST_DRY_RUN',
defaultValue: false,
description: 'Should the job report ignore the actual test run and just print the test plan?'
)
}

options {
Expand Down Expand Up @@ -72,6 +77,7 @@ pipeline {
UNIT_TEST_RERUN_FAILS = "${params.UNIT_TEST_RERUN_FAILS}"
UNIT_TEST_USE_DEVELOPMENT_LOGGER = "${params.UNIT_TEST_USE_DEVELOPMENT_LOGGER}"
UNIT_TEST_REPORT_CODECLIMATE = "${params.UNIT_TEST_REPORT_CODECLIMATE}"
UNIT_TEST_DRY_RUN = "${params.UNIT_TEST_DRY_RUN}"
}

stages {
Expand Down
8 changes: 8 additions & 0 deletions _assets/scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ run_test_for_packages() {
local exit_code_file="exit_code_${iteration}.txt"
local timeout="$(( single_timeout * count))m"

if [[ "${UNIT_TEST_DRY_RUN}" == 'true' ]]; then
echo -e "${GRN}Dry run ${iteration}. message:${RST} ${log_message}\n"\
"${YLW}Dry run ${iteration}. packages:${RST} ${packages}\n"\
"${YLW}Dry run ${iteration}. count:${RST} ${count}\n"\
"${YLW}Dry run ${iteration}. timeout:${RST} ${timeout}"
return 0
fi

echo -e "${GRN}Testing:${RST} ${log_message}. Iteration ${iteration}. -test.count=${count}. Timeout: ${timeout}"

gotestsum_flags="${GOTESTSUM_EXTRAFLAGS}"
Expand Down

0 comments on commit 4c9ff3f

Please sign in to comment.