From 89e3d6c9cd438e157c5156d7baed62f11d50bf1e Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 10:45:33 +0100 Subject: [PATCH 01/10] try gotestloghelper with branch version --- .github/workflows/ci-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 7f5f0c091f8..62cec1ba3f5 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -233,7 +233,7 @@ jobs: - name: Install gotestloghelper if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@v1.50.0 + run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@tt-1806-gotestloghelper-bump-deps - name: Run tests if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} From 5b829d3bd78a66626e744d4a7068ed230fcbd5a3 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 11:02:07 +0100 Subject: [PATCH 02/10] fail core tests on purpose --- core/chains/evm/logpoller/log_poller_test.go | 3 +++ core/sessions/user_test.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/core/chains/evm/logpoller/log_poller_test.go b/core/chains/evm/logpoller/log_poller_test.go index 7114960efdd..193d2d4247d 100644 --- a/core/chains/evm/logpoller/log_poller_test.go +++ b/core/chains/evm/logpoller/log_poller_test.go @@ -411,6 +411,9 @@ func TestLogPoller_BackupPollAndSaveLogsWithPollerNotWorking(t *testing.T) { } th := SetupTH(t, lpOpts) + //TODO on purpose + panic("on purpose") + // Emit some logs in blocks for i := 0; i < emittedLogs; i++ { if i == 30 { diff --git a/core/sessions/user_test.go b/core/sessions/user_test.go index 6805d90d6ce..90964aaf493 100644 --- a/core/sessions/user_test.go +++ b/core/sessions/user_test.go @@ -52,6 +52,10 @@ func TestNewUser(t *testing.T) { func TestUserGenerateAuthToken(t *testing.T) { var user sessions.User token, err := user.GenerateAuthToken() + + //TODO fail on purpose + require.True(t, false, "on purpose") + require.NoError(t, err) assert.Equal(t, null.StringFrom(token.AccessKey), user.TokenKey) assert.NotEqual(t, null.StringFrom(token.Secret), user.TokenHashedSecret) From 67b504fd90b65fa6debe86c8d3c32327f0a14385 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 15:29:22 +0100 Subject: [PATCH 03/10] use tee by default for processing output of core go tests, do not use -json flag, remove gotestloghelper --- .github/workflows/ci-core.yml | 13 ------------- tools/bin/go_core_ccip_deployment_tests | 10 +++++----- tools/bin/go_core_race_tests | 9 +++++---- tools/bin/go_core_tests | 11 ++++++----- tools/bin/go_core_tests_integration | 9 +++++---- 5 files changed, 21 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 62cec1ba3f5..ca8f3230218 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -231,26 +231,13 @@ jobs: echo "COUNT=50" >> $GITHUB_ENV echo "FUZZ_TIMEOUT_MINUTES=10">> $GITHUB_ENV - - name: Install gotestloghelper - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@tt-1806-gotestloghelper-bump-deps - - name: Run tests if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} id: run-tests env: - OUTPUT_FILE: ./output.txt - USE_TEE: false CL_DATABASE_URL: ${{ env.DB_URL }} run: ./tools/bin/${{ matrix.type.cmd }} ./... - - name: Print Filtered Test Results - if: ${{ failure() && needs.filter.outputs.should-run-ci-core == 'true' && steps.run-tests.conclusion == 'failure' }} - run: | - if [[ "${{ matrix.type.printResults }}" == "true" ]]; then - cat output.txt | gotestloghelper -ci - fi - - name: Print Races id: print-races if: ${{ failure() && matrix.type.cmd == 'go_core_race_tests' && needs.filter.outputs.should-run-ci-core == 'true' }} diff --git a/tools/bin/go_core_ccip_deployment_tests b/tools/bin/go_core_ccip_deployment_tests index 6f1ef8d01cf..c3982982cb7 100755 --- a/tools/bin/go_core_ccip_deployment_tests +++ b/tools/bin/go_core_ccip_deployment_tests @@ -11,14 +11,14 @@ go mod download echo "Failed tests and panics: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then - if [[ $DEBUG == "true" ]]; then - go test -json ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | tee $OUTPUT_FILE + if [[ $USE_TEE == "true" ]]; then + go test ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' else - go test -json ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | cat > $OUTPUT_FILE + go test ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | cat > $OUTPUT_FILE fi else - if [[ $DEBUG == "true" ]]; then - go test ./... | tee $OUTPUT_FILE + if [[ $USE_TEE == "true" ]]; then + go test ./... | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' else go test ./... | cat > $OUTPUT_FILE fi diff --git a/tools/bin/go_core_race_tests b/tools/bin/go_core_race_tests index 2af12b86403..e191c140284 100755 --- a/tools/bin/go_core_race_tests +++ b/tools/bin/go_core_race_tests @@ -3,18 +3,19 @@ set -ex OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} TIMEOUT="${TIMEOUT:-10s}" COUNT="${COUNT:-5}" +USE_TEE="${USE_TEE:-true}" echo "Failed tests and panics: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then - if [[ $DEBUG == "true" ]]; then - GORACE="log_path=$PWD/race" go test -json -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | tee $OUTPUT_FILE + if [[ $USE_TEE == "true" ]]; then + GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' else GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE fi else - if [[ $DEBUG == "true" ]]; then - GORACE="log_path=$PWD/race" go test -json -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | tee $OUTPUT_FILE + if [[ $USE_TEE == "true" ]]; then + GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' else GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE fi diff --git a/tools/bin/go_core_tests b/tools/bin/go_core_tests index 92e32b4ae94..a96cf9e6827 100755 --- a/tools/bin/go_core_tests +++ b/tools/bin/go_core_tests @@ -4,18 +4,19 @@ set +e SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} +USE_TEE="${USE_TEE:-true}" echo "Failed tests and panics: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then - if [[ $DEBUG == "true" ]]; then - go test -json -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | tee $OUTPUT_FILE + if [[ $USE_TEE == "true" ]]; then + go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' else - go test -json -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | cat > $OUTPUT_FILE + go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | cat > $OUTPUT_FILE fi else - if [[ $DEBUG == "true" ]]; then - go test $1 | tee $OUTPUT_FILE + if [[ $USE_TEE == "true" ]]; then + go test $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' else go test $1 | cat > $OUTPUT_FILE fi diff --git a/tools/bin/go_core_tests_integration b/tools/bin/go_core_tests_integration index fed80c4bbd5..5f3c24e56d6 100755 --- a/tools/bin/go_core_tests_integration +++ b/tools/bin/go_core_tests_integration @@ -4,6 +4,7 @@ set +e SCRIPT_PATH=$(dirname "$0"); SCRIPT_PATH=$(eval "cd \"$SCRIPT_PATH\" && pwd") OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} +USE_TEE="${USE_TEE:-true}" echo "Finding and running integration-tagged tests" INTEGRATION_TAGGED_TEST_FILES=$(find . -name '*_test.go' -exec grep -l '//go:build integration' {} +) @@ -20,13 +21,13 @@ if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then # Experimental code to minimize size of this coverage report # ALL_IMPORTS=$(go list -f '{{ join .Imports "\n" }}' $INTEGRATION_TEST_DIRS | sort -u) # COVERPKG_DIRS=$(echo "$INTEGRATION_TEST_DIRS $ALL_IMPORTS" | grep "smartcontractkit/chainlink" | tr '\n' ',') - if [[ $DEBUG == "true" ]]; then - go test -json -tags integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | tee $OUTPUT_FILE + if [[ $USE_TEE == "true" ]]; then + go test -tags integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' else - go test -json -tags integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | cat > $OUTPUT_FILE + go test -tags integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | cat > $OUTPUT_FILE fi else - if [[ $DEBUG == "true" ]]; then + if [[ $USE_TEE == "true" ]]; then go test -tags integration $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | tee $OUTPUT_FILE else go test -tags integration $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | cat > $OUTPUT_FILE From 6a68e3a22958d2a7525d52767eaad77863493ffa Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 16:08:41 +0100 Subject: [PATCH 04/10] rename log message, filter out no tests/test files from fuzz tests --- tools/bin/go_core_ccip_deployment_tests | 2 +- tools/bin/go_core_fuzz | 2 +- tools/bin/go_core_race_tests | 2 +- tools/bin/go_core_tests | 2 +- tools/bin/go_core_tests_integration | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/bin/go_core_ccip_deployment_tests b/tools/bin/go_core_ccip_deployment_tests index c3982982cb7..be902964400 100755 --- a/tools/bin/go_core_ccip_deployment_tests +++ b/tools/bin/go_core_ccip_deployment_tests @@ -8,7 +8,7 @@ USE_TEE="${USE_TEE:-true}" cd ./deployment || exit go mod download -echo "Failed tests and panics: ---------------------" +echo "Test execution results: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then if [[ $USE_TEE == "true" ]]; then diff --git a/tools/bin/go_core_fuzz b/tools/bin/go_core_fuzz index 49aaf33b65e..65c9273a418 100755 --- a/tools/bin/go_core_fuzz +++ b/tools/bin/go_core_fuzz @@ -19,7 +19,7 @@ echo "timeout minutes: $FUZZ_TIMEOUT_MINUTES" echo "fuzz seconds: $FUZZ_SECONDS" echo "Failed fuzz tests and panics: ---------------------" echo "" -timeout "${FUZZ_TIMEOUT_MINUTES}"m ./fuzz/fuzz_all_native.py --ci --seconds "$FUZZ_SECONDS" --go_module_root ./ | tee $OUTPUT_FILE +timeout "${FUZZ_TIMEOUT_MINUTES}"m ./fuzz/fuzz_all_native.py --ci --seconds "$FUZZ_SECONDS" --go_module_root ./ | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' EXITCODE=${PIPESTATUS[0]} # Assert no known sensitive strings present in test logger output diff --git a/tools/bin/go_core_race_tests b/tools/bin/go_core_race_tests index e191c140284..cd0b2c24a1f 100755 --- a/tools/bin/go_core_race_tests +++ b/tools/bin/go_core_race_tests @@ -5,7 +5,7 @@ TIMEOUT="${TIMEOUT:-10s}" COUNT="${COUNT:-5}" USE_TEE="${USE_TEE:-true}" -echo "Failed tests and panics: ---------------------" +echo "Test execution results: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then if [[ $USE_TEE == "true" ]]; then diff --git a/tools/bin/go_core_tests b/tools/bin/go_core_tests index a96cf9e6827..a7ce9d5a190 100755 --- a/tools/bin/go_core_tests +++ b/tools/bin/go_core_tests @@ -6,7 +6,7 @@ SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} USE_TEE="${USE_TEE:-true}" -echo "Failed tests and panics: ---------------------" +echo "Test execution results: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then if [[ $USE_TEE == "true" ]]; then diff --git a/tools/bin/go_core_tests_integration b/tools/bin/go_core_tests_integration index 5f3c24e56d6..c22952318be 100755 --- a/tools/bin/go_core_tests_integration +++ b/tools/bin/go_core_tests_integration @@ -15,7 +15,7 @@ fi INTEGRATION_TEST_DIRS=$(echo "$INTEGRATION_TAGGED_TEST_FILES" | xargs -n1 dirname | sort -u) INTEGRATION_TEST_DIRS_SPACE_DELIMITED=$(echo "$INTEGRATION_TEST_DIRS" | tr '\n' ' ') -echo "Failed tests and panics: ---------------------" +echo "Test execution results: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then # Experimental code to minimize size of this coverage report From 72300eff4f3960ee06acdac887fa1772b0f3516c Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 16:29:17 +0100 Subject: [PATCH 05/10] remove on-purpose core test failure --- core/chains/evm/logpoller/log_poller_test.go | 3 --- core/sessions/user_test.go | 3 --- 2 files changed, 6 deletions(-) diff --git a/core/chains/evm/logpoller/log_poller_test.go b/core/chains/evm/logpoller/log_poller_test.go index 193d2d4247d..7114960efdd 100644 --- a/core/chains/evm/logpoller/log_poller_test.go +++ b/core/chains/evm/logpoller/log_poller_test.go @@ -411,9 +411,6 @@ func TestLogPoller_BackupPollAndSaveLogsWithPollerNotWorking(t *testing.T) { } th := SetupTH(t, lpOpts) - //TODO on purpose - panic("on purpose") - // Emit some logs in blocks for i := 0; i < emittedLogs; i++ { if i == 30 { diff --git a/core/sessions/user_test.go b/core/sessions/user_test.go index 90964aaf493..0a72d610cf7 100644 --- a/core/sessions/user_test.go +++ b/core/sessions/user_test.go @@ -53,9 +53,6 @@ func TestUserGenerateAuthToken(t *testing.T) { var user sessions.User token, err := user.GenerateAuthToken() - //TODO fail on purpose - require.True(t, false, "on purpose") - require.NoError(t, err) assert.Equal(t, null.StringFrom(token.AccessKey), user.TokenKey) assert.NotEqual(t, null.StringFrom(token.Secret), user.TokenHashedSecret) From f8e64b900c2cb5efe9e88102a7f2dc2e7ab034c2 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 16:53:08 +0100 Subject: [PATCH 06/10] remove non-tee mode from running go core tests, simplify all conditions --- tools/bin/go_core_ccip_deployment_tests | 16 ++++------------ tools/bin/go_core_race_tests | 13 ++----------- tools/bin/go_core_tests | 15 +++------------ tools/bin/go_core_tests_integration | 15 +++------------ 4 files changed, 12 insertions(+), 47 deletions(-) diff --git a/tools/bin/go_core_ccip_deployment_tests b/tools/bin/go_core_ccip_deployment_tests index be902964400..57044617d9f 100755 --- a/tools/bin/go_core_ccip_deployment_tests +++ b/tools/bin/go_core_ccip_deployment_tests @@ -4,25 +4,17 @@ set +e SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` OUTPUT_FILE="../output.txt" -USE_TEE="${USE_TEE:-true}" +EXTRA_FLAGS = "" cd ./deployment || exit go mod download echo "Test execution results: ---------------------" echo "" + if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then - if [[ $USE_TEE == "true" ]]; then - go test ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' - else - go test ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | cat > $OUTPUT_FILE - fi -else - if [[ $USE_TEE == "true" ]]; then - go test ./... | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' - else - go test ./... | cat > $OUTPUT_FILE - fi + EXTRA_FLAGS="-covermode=atomic -coverpkg=./... -coverprofile=coverage.txt" fi +go test ./... "$EXTRA_FLAGS" | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' EXITCODE=${PIPESTATUS[0]} # Assert no known sensitive strings present in test logger output diff --git a/tools/bin/go_core_race_tests b/tools/bin/go_core_race_tests index cd0b2c24a1f..27046c47a6c 100755 --- a/tools/bin/go_core_race_tests +++ b/tools/bin/go_core_race_tests @@ -3,22 +3,13 @@ set -ex OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} TIMEOUT="${TIMEOUT:-10s}" COUNT="${COUNT:-5}" -USE_TEE="${USE_TEE:-true}" echo "Test execution results: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then - if [[ $USE_TEE == "true" ]]; then - GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' - else - GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE - fi + GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE else - if [[ $USE_TEE == "true" ]]; then - GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' - else - GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE - fi + GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE fi EXITCODE=${PIPESTATUS[0]} diff --git a/tools/bin/go_core_tests b/tools/bin/go_core_tests index a7ce9d5a190..2d62d7a039d 100755 --- a/tools/bin/go_core_tests +++ b/tools/bin/go_core_tests @@ -4,23 +4,14 @@ set +e SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} -USE_TEE="${USE_TEE:-true}" +EXTRA_FLAGS = "" echo "Test execution results: ---------------------" echo "" if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then - if [[ $USE_TEE == "true" ]]; then - go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' - else - go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | cat > $OUTPUT_FILE - fi -else - if [[ $USE_TEE == "true" ]]; then - go test $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' - else - go test $1 | cat > $OUTPUT_FILE - fi + EXTRA_FLAGS="-covermode=atomic -coverpkg=./... -coverprofile=coverage.txt" fi +go test "$EXTRA_FLAGS" $1 | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' EXITCODE=${PIPESTATUS[0]} # Assert no known sensitive strings present in test logger output diff --git a/tools/bin/go_core_tests_integration b/tools/bin/go_core_tests_integration index c22952318be..ce4889c75a2 100755 --- a/tools/bin/go_core_tests_integration +++ b/tools/bin/go_core_tests_integration @@ -4,7 +4,7 @@ set +e SCRIPT_PATH=$(dirname "$0"); SCRIPT_PATH=$(eval "cd \"$SCRIPT_PATH\" && pwd") OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} -USE_TEE="${USE_TEE:-true}" +EXTRA_FLAGS = "" echo "Finding and running integration-tagged tests" INTEGRATION_TAGGED_TEST_FILES=$(find . -name '*_test.go' -exec grep -l '//go:build integration' {} +) @@ -21,18 +21,9 @@ if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then # Experimental code to minimize size of this coverage report # ALL_IMPORTS=$(go list -f '{{ join .Imports "\n" }}' $INTEGRATION_TEST_DIRS | sort -u) # COVERPKG_DIRS=$(echo "$INTEGRATION_TEST_DIRS $ALL_IMPORTS" | grep "smartcontractkit/chainlink" | tr '\n' ',') - if [[ $USE_TEE == "true" ]]; then - go test -tags integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' - else - go test -tags integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | cat > $OUTPUT_FILE - fi -else - if [[ $USE_TEE == "true" ]]; then - go test -tags integration $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | tee $OUTPUT_FILE - else - go test -tags integration $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | cat > $OUTPUT_FILE - fi + EXTRA_FLAGS = "-covermode=atomic -coverpkg=./... -coverprofile=coverage.txt" fi +go test -tags integration "$EXTRA_FLAGS" $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' EXITCODE=${PIPESTATUS[0]} # Assert no known sensitive strings present in test logger output From af531f6ea23db4cd8d3edb39c1bc844b11101209 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 16:55:33 +0100 Subject: [PATCH 07/10] remove extra new line from test --- .github/workflows/ci-core.yml | 1 + core/sessions/user_test.go | 1 - tools/bin/go_core_ccip_deployment_tests | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index ca8f3230218..c38ecd918ae 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -235,6 +235,7 @@ jobs: if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} id: run-tests env: + OUTPUT_FILE: ./output.txt CL_DATABASE_URL: ${{ env.DB_URL }} run: ./tools/bin/${{ matrix.type.cmd }} ./... diff --git a/core/sessions/user_test.go b/core/sessions/user_test.go index 0a72d610cf7..6805d90d6ce 100644 --- a/core/sessions/user_test.go +++ b/core/sessions/user_test.go @@ -52,7 +52,6 @@ func TestNewUser(t *testing.T) { func TestUserGenerateAuthToken(t *testing.T) { var user sessions.User token, err := user.GenerateAuthToken() - require.NoError(t, err) assert.Equal(t, null.StringFrom(token.AccessKey), user.TokenKey) assert.NotEqual(t, null.StringFrom(token.Secret), user.TokenHashedSecret) diff --git a/tools/bin/go_core_ccip_deployment_tests b/tools/bin/go_core_ccip_deployment_tests index 57044617d9f..5aaf2b90c40 100755 --- a/tools/bin/go_core_ccip_deployment_tests +++ b/tools/bin/go_core_ccip_deployment_tests @@ -3,7 +3,7 @@ set -o pipefail set +e SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` -OUTPUT_FILE="../output.txt" +OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} EXTRA_FLAGS = "" cd ./deployment || exit From c02c036e7e18f394d1916f2036e2fa5ed6c2bb84 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 18:57:08 +0100 Subject: [PATCH 08/10] remove whitespaces --- tools/bin/go_core_ccip_deployment_tests | 2 +- tools/bin/go_core_tests | 2 +- tools/bin/go_core_tests_integration | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/bin/go_core_ccip_deployment_tests b/tools/bin/go_core_ccip_deployment_tests index 5aaf2b90c40..4534ade2804 100755 --- a/tools/bin/go_core_ccip_deployment_tests +++ b/tools/bin/go_core_ccip_deployment_tests @@ -4,7 +4,7 @@ set +e SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} -EXTRA_FLAGS = "" +EXTRA_FLAGS="" cd ./deployment || exit go mod download diff --git a/tools/bin/go_core_tests b/tools/bin/go_core_tests index 2d62d7a039d..0fffcb72a39 100755 --- a/tools/bin/go_core_tests +++ b/tools/bin/go_core_tests @@ -4,7 +4,7 @@ set +e SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} -EXTRA_FLAGS = "" +EXTRA_FLAGS="" echo "Test execution results: ---------------------" echo "" diff --git a/tools/bin/go_core_tests_integration b/tools/bin/go_core_tests_integration index ce4889c75a2..323e9d526ac 100755 --- a/tools/bin/go_core_tests_integration +++ b/tools/bin/go_core_tests_integration @@ -4,7 +4,7 @@ set +e SCRIPT_PATH=$(dirname "$0"); SCRIPT_PATH=$(eval "cd \"$SCRIPT_PATH\" && pwd") OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} -EXTRA_FLAGS = "" +EXTRA_FLAGS="" echo "Finding and running integration-tagged tests" INTEGRATION_TAGGED_TEST_FILES=$(find . -name '*_test.go' -exec grep -l '//go:build integration' {} +) @@ -21,7 +21,7 @@ if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then # Experimental code to minimize size of this coverage report # ALL_IMPORTS=$(go list -f '{{ join .Imports "\n" }}' $INTEGRATION_TEST_DIRS | sort -u) # COVERPKG_DIRS=$(echo "$INTEGRATION_TEST_DIRS $ALL_IMPORTS" | grep "smartcontractkit/chainlink" | tr '\n' ',') - EXTRA_FLAGS = "-covermode=atomic -coverpkg=./... -coverprofile=coverage.txt" + EXTRA_FLAGS="-covermode=atomic -coverpkg=./... -coverprofile=coverage.txt" fi go test -tags integration "$EXTRA_FLAGS" $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | tee $OUTPUT_FILE | grep -Ev '\[no test files\]|\[no tests to run\]' EXITCODE=${PIPESTATUS[0]} From ae038da8a2884b74443208e24ac0c7ca44bac4d8 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 19:40:37 +0100 Subject: [PATCH 09/10] fix relative path --- tools/bin/go_core_ccip_deployment_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bin/go_core_ccip_deployment_tests b/tools/bin/go_core_ccip_deployment_tests index 4534ade2804..de976741398 100755 --- a/tools/bin/go_core_ccip_deployment_tests +++ b/tools/bin/go_core_ccip_deployment_tests @@ -3,7 +3,7 @@ set -o pipefail set +e SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"` -OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"} +OUTPUT_FILE=${OUTPUT_FILE:-"../output.txt"} EXTRA_FLAGS="" cd ./deployment || exit From 3ca262ff4814688926db81a1455b4955972f5c8f Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 25 Nov 2024 21:09:06 +0100 Subject: [PATCH 10/10] remove superfluous if --- tools/bin/go_core_race_tests | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/bin/go_core_race_tests b/tools/bin/go_core_race_tests index 27046c47a6c..467dda4e92f 100755 --- a/tools/bin/go_core_race_tests +++ b/tools/bin/go_core_race_tests @@ -6,11 +6,7 @@ COUNT="${COUNT:-5}" echo "Test execution results: ---------------------" echo "" -if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then - GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE -else - GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE -fi +GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE EXITCODE=${PIPESTATUS[0]}