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
13 changes: 0 additions & 13 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]

- 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
1 change: 1 addition & 0 deletions core/sessions/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ 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)
Expand Down
12 changes: 6 additions & 6 deletions tools/bin/go_core_ccip_deployment_tests
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ 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 [[ $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
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
11 changes: 6 additions & 5 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 @@ -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 "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
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
Expand Down
13 changes: 7 additions & 6 deletions tools/bin/go_core_tests
Original file line number Diff line number Diff line change
Expand Up @@ -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 "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
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
Tofel marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down
11 changes: 6 additions & 5 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"}
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' {} +)
Expand All @@ -14,19 +15,19 @@ 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
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
Expand Down
Loading