File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -102,3 +102,24 @@ jobs:
102
102
103
103
- run : GOTRACEBACK=all make test
104
104
105
+ stress-new-tests :
106
+ if : github.event_name == 'pull_request' # Skip job unless it's a PR
107
+ runs-on : ubuntu-latest
108
+
109
+ steps :
110
+ - name : Checkout code
111
+ uses : actions/checkout@v4
112
+ with :
113
+ fetch-depth : 0
114
+
115
+ - name : Set up Go
116
+ uses : actions/setup-go@v5
117
+ with :
118
+ go-version : ' 1.24'
119
+
120
+ - name : Stress new tests
121
+ env :
122
+ BASE_BRANCH : origin/${{ github.base_ref }}
123
+ run : |
124
+ go install github.com/cockroachdb/stress@latest
125
+ bash scripts/stress-new-tests.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -euo pipefail
3
+
4
+ # Base branch to diff against
5
+ BASE_BRANCH=" ${BASE_BRANCH:- origin/ master} "
6
+ MODULE_PREFIX=" github.com/cockroachdb/pebble"
7
+
8
+ # Loop through each Go package
9
+ echo " Checking packages for new tests..."
10
+ for pkg in $( go list ./...) ; do
11
+ # Strip module prefix to get relative path
12
+ pkg=${pkg# ${MODULE_PREFIX} }
13
+ pkg=" ./${pkg#/ } " # Ensure ./ and remove any leading /
14
+
15
+ # Get added test functions in this package
16
+ added_tests=$( git diff --no-ext-diff " $BASE_BRANCH " --unified=0 -- " $pkg " /* .go 2> /dev/null \
17
+ | grep ' ^+func Test' \
18
+ | awk ' {print $2}' \
19
+ | cut -d' (' -f1 \
20
+ | sort -u || true)
21
+
22
+ if [[ -z " $added_tests " ]]; then
23
+ continue
24
+ fi
25
+
26
+ # Build regex for go test -run
27
+ regex=$( echo " $added_tests " | paste -sd ' |' -)
28
+ full_regex=" ^($regex )$"
29
+
30
+ echo " "
31
+ echo " Found new tests in $pkg "
32
+
33
+ echo " go test --tags invariants --exec 'stress -p 2 --maxruns 1000 --maxtime 10m --timeout 2m' -v -run \" $full_regex \" \" $pkg \" "
34
+ go test --tags invariants --exec ' stress -p 2 --maxruns 1000 --maxtime 10m --timeout 2m' -v -run " $full_regex " " $pkg " || {
35
+ echo " "
36
+ echo " ❌ Failure in $pkg with new tests: $regex "
37
+ exit 1
38
+ }
39
+ done
40
+
41
+ echo " ✅ All stress tests passed."
You can’t perform that action at this time.
0 commit comments