Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit b927cff

Browse files
cpuguy83thaJeztah
authored andcommitted
Improve integration test detecetor
The "new test" detector in test-integration-flaky was a bit flaky since it would detect function signatures that are not new tests. In addition, the test calls `return` outside of a function which is not allowed. Signed-off-by: Brian Goff <cpuguy83@gmail.com> (cherry picked from commit e2b24490e45fb1e024c0b1594bf978573b91271c) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: cb9414bbb7f5c979f99dd76368ecad244003f8d5 Component: engine
1 parent 591e431 commit b927cff

1 file changed

Lines changed: 28 additions & 22 deletions

File tree

components/engine/hack/make/test-integration-flaky

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,34 @@
22
set -e -o pipefail
33

44
source hack/validate/.validate
5-
new_tests=$(
6-
validate_diff --diff-filter=ACMR --unified=0 -- 'integration/*_test.go' |
7-
grep -E '^(\+func )(.*)(\*testing)' || true
8-
)
95

10-
if [ -z "$new_tests" ]; then
11-
echo 'No new tests added to integration.'
12-
return
13-
fi
146

15-
echo
16-
echo "Found new integrations tests:"
17-
echo "$new_tests"
18-
echo "Running stress test for them."
7+
run_integration_flaky() {
8+
new_tests=$(
9+
validate_diff --diff-filter=ACMR --unified=0 -- 'integration/*_test.go' |
10+
grep -E '^(\+func Test)(.*)(\*testing\.T\))' || true
11+
)
1912

20-
(
21-
TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
22-
# Note: TEST_REPEAT will make the test suite run 5 times, restarting the daemon
23-
# and each test will run 5 times in a row under the same daemon.
24-
# This will make a total of 25 runs for each test in TESTARRAY.
25-
export TEST_REPEAT=5
26-
export TESTFLAGS="-test.count ${TEST_REPEAT} -test.run ${TESTARRAY%?}"
27-
echo "Using test flags: $TESTFLAGS"
28-
source hack/make/test-integration
29-
)
13+
if [ -z "$new_tests" ]; then
14+
echo 'No new tests added to integration.'
15+
return
16+
fi
17+
18+
echo
19+
echo "Found new integrations tests:"
20+
echo "$new_tests"
21+
echo "Running stress test for them."
22+
23+
(
24+
TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
25+
# Note: TEST_REPEAT will make the test suite run 5 times, restarting the daemon
26+
# and each test will run 5 times in a row under the same daemon.
27+
# This will make a total of 25 runs for each test in TESTARRAY.
28+
export TEST_REPEAT=5
29+
export TESTFLAGS="-test.count ${TEST_REPEAT} -test.run ${TESTARRAY%?}"
30+
echo "Using test flags: $TESTFLAGS"
31+
source hack/make/test-integration
32+
)
33+
}
34+
35+
run_integration_flaky

0 commit comments

Comments
 (0)