Skip to content

Commit 56a1413

Browse files
authored
chore: enable shuffle testing for most core packages (#4061)
Co-authored-by: felix.geisendoerfer <[email protected]>
1 parent 4f683d0 commit 56a1413

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

scripts/ci_test_core.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,32 @@ report_error=0
66

77
TEST_RESULTS="${TEST_RESULTS:-.}"
88
mkdir -p "$TEST_RESULTS"
9-
mapfile -t PACKAGE_NAMES < <(go list ./... | grep -v /contrib/)
109

11-
# Set +e so that we run both of the test commands even if
12-
# the first one fails
10+
# Packages that don't support -shuffle on yet
11+
NO_SHUFFLE_PATTERN="(github\.com/DataDog/dd-trace-go/v2/ddtrace/tracer|\
12+
github\.com/DataDog/dd-trace-go/v2/internal/civisibility/utils|\
13+
github\.com/DataDog/dd-trace-go/v2/profiler|\
14+
github\.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo|\
15+
github\.com/DataDog/dd-trace-go/v2/instrumentation/httptrace)$"
16+
17+
mapfile -t SHUFFLE_PACKAGES < <(go list ./... | grep -v /contrib/ | grep -Ev "$NO_SHUFFLE_PATTERN")
18+
mapfile -t NO_SHUFFLE_PACKAGES < <(go list ./... | grep -v /contrib/ | grep -E "$NO_SHUFFLE_PATTERN")
19+
20+
# Set +e so that we run all test commands even if one fails
1321
set +e
1422

1523
export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
1624

17-
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report.xml" -- -v -race -coverprofile=coverage.txt -covermode=atomic "${PACKAGE_NAMES[@]}"
25+
# Run tests with shuffle for packages that support it
26+
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report.xml" -- -v -race -shuffle=on -coverprofile=coverage.txt -covermode=atomic "${SHUFFLE_PACKAGES[@]}"
27+
test_exit=$?
28+
[[ $test_exit -ne 0 ]] && report_error=1
29+
30+
# Run tests without shuffle for packages that don't support it yet
31+
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-noshuffle.xml" -- -v -race -coverprofile=coverage-noshuffle.txt -covermode=atomic "${NO_SHUFFLE_PACKAGES[@]}"
1832
test_exit=$?
1933
[[ $test_exit -ne 0 ]] && report_error=1
34+
2035
cd ./internal/exectracetest
2136
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-exectrace.xml" -- -v -race -coverprofile=coverage.txt -covermode=atomic ./...
2237
test_exit=$?

0 commit comments

Comments
 (0)