Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove gotestloghelper from core tests #15395

Merged
merged 10 commits into from
Nov 25, 2024
12 changes: 0 additions & 12 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,26 +231,14 @@ 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@v1.50.0

- 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' }}
Expand Down
20 changes: 6 additions & 14 deletions tools/bin/go_core_ccip_deployment_tests
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,18 @@ set -o pipefail
set +e

SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"`
OUTPUT_FILE="../output.txt"
USE_TEE="${USE_TEE:-true}"
OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pathing has changed a bit, it used to be ‘../output.txt’ because this test cds into the deployment directory.

I think we need to keep it in the parent directory otherwise the artifact upload will not be able to find the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, @erikburt!

EXTRA_FLAGS=""

cd ./deployment || exit
go mod download
echo "Failed tests and panics: ---------------------"
echo "Test execution results: ---------------------"
echo ""

if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then
if [[ $DEBUG == "true" ]]; then
go test -json ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | tee $OUTPUT_FILE
else
go test -json ./... -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt | cat > $OUTPUT_FILE
fi
else
if [[ $DEBUG == "true" ]]; then
go test ./... | tee $OUTPUT_FILE
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
Expand Down
2 changes: 1 addition & 1 deletion tools/bin/go_core_fuzz
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 3 additions & 11 deletions tools/bin/go_core_race_tests
Tofel marked this conversation as resolved.
Show resolved Hide resolved
jmank88 marked this conversation as resolved.
Show resolved Hide resolved
Tofel marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 10 and 12 are both identical:

GORACE="log_path=$PWD/race" go test -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | cat > $OUTPUT_FILE

Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"}
TIMEOUT="${TIMEOUT:-10s}"
COUNT="${COUNT:-5}"

echo "Failed tests and panics: ---------------------"
echo "Test execution results: ---------------------"
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
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 [[ $DEBUG == "true" ]]; then
GORACE="log_path=$PWD/race" go test -json -race -shuffle on -timeout "$TIMEOUT" -count "$COUNT" $1 | tee $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
fi
EXITCODE=${PIPESTATUS[0]}

Expand Down
16 changes: 4 additions & 12 deletions tools/bin/go_core_tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@ set +e

SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"`
OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"}
EXTRA_FLAGS=""

echo "Failed tests and panics: ---------------------"
echo "Test execution results: ---------------------"
echo ""
if [[ $GITHUB_EVENT_NAME == "schedule" ]]; then
if [[ $DEBUG == "true" ]]; then
go test -json -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | tee $OUTPUT_FILE
else
go test -json -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $1 | cat > $OUTPUT_FILE
fi
else
if [[ $DEBUG == "true" ]]; then
go test $1 | tee $OUTPUT_FILE
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
Expand Down
16 changes: 4 additions & 12 deletions tools/bin/go_core_tests_integration
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set +e

SCRIPT_PATH=$(dirname "$0"); SCRIPT_PATH=$(eval "cd \"$SCRIPT_PATH\" && pwd")
OUTPUT_FILE=${OUTPUT_FILE:-"./output.txt"}
EXTRA_FLAGS=""

echo "Finding and running integration-tagged tests"
INTEGRATION_TAGGED_TEST_FILES=$(find . -name '*_test.go' -exec grep -l '//go:build integration' {} +)
Expand All @@ -14,24 +15,15 @@ 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
# 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
else
go test -json -tags integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt $INTEGRATION_TEST_DIRS_SPACE_DELIMITED | cat > $OUTPUT_FILE
fi
else
if [[ $DEBUG == "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
Expand Down
Loading