Also run `test-integration-flaky` for changed existing tests.
Keep the old added-test detection as-is, and add modified-test detection
on top of it to avoid regressing the existing behavior.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| ... | ... |
@@ -3,26 +3,40 @@ set -e -o pipefail |
| 3 | 3 |
|
| 4 | 4 |
source hack/validate/.validate |
| 5 | 5 |
|
| 6 |
+added_tests() {
|
|
| 7 |
+ validate_diff --diff-filter=ACMR --unified=0 -- 'integration/*_test.go' \ |
|
| 8 |
+ | grep -E '^(\+func Test)(.*)(\*testing\.T\))' \ |
|
| 9 |
+ | sed -E 's/^\+func (Test[A-Za-z0-9_]*).*/\1/' \ |
|
| 10 |
+ || true |
|
| 11 |
+} |
|
| 12 |
+ |
|
| 13 |
+changed_tests() {
|
|
| 14 |
+ validate_diff --diff-filter=ACMR --function-context -- 'integration/*_test.go' \ |
|
| 15 |
+ | grep -E '^ func Test[A-Za-z0-9_]*\(.*\*testing\.T\)' \ |
|
| 16 |
+ | sed -E 's/^ func (Test[A-Za-z0-9_]*).*/\1/' \ |
|
| 17 |
+ || true |
|
| 18 |
+} |
|
| 19 |
+ |
|
| 6 | 20 |
run_integration_flaky() {
|
| 7 |
- diff=$( |
|
| 8 |
- validate_diff --diff-filter=ACMR --unified=0 -- 'integration/*_test.go' |
|
| 9 |
- ) |
|
| 10 |
- new_tests=$( |
|
| 11 |
- printf '%s\n' "$diff" | grep -E '^(\+func Test)(.*)(\*testing\.T\))' || true |
|
| 21 |
+ tests=$( |
|
| 22 |
+ {
|
|
| 23 |
+ added_tests |
|
| 24 |
+ changed_tests |
|
| 25 |
+ } | sort -u |
|
| 12 | 26 |
) |
| 13 | 27 |
|
| 14 |
- if [ -z "$new_tests" ]; then |
|
| 15 |
- echo 'No new tests added to integration.' |
|
| 28 |
+ if [ -z "$tests" ]; then |
|
| 29 |
+ echo 'No new or modified tests found in integration.' |
|
| 16 | 30 |
return |
| 17 | 31 |
fi |
| 18 | 32 |
|
| 19 | 33 |
echo |
| 20 |
- echo "Found new integrations tests:" |
|
| 21 |
- echo "$new_tests" |
|
| 34 |
+ echo "Found new or modified integration tests:" |
|
| 35 |
+ echo "$tests" |
|
| 22 | 36 |
echo "Running stress test for them." |
| 23 | 37 |
|
| 24 | 38 |
( |
| 25 |
- TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
|
|
| 39 |
+ TESTARRAY=$(echo "$tests" | tr '\n' '|') |
|
| 26 | 40 |
# Note: TEST_REPEAT will make the test suite run 5 times, restarting the daemon |
| 27 | 41 |
# and each test will run 5 times in a row under the same daemon. |
| 28 | 42 |
# This will make a total of 25 runs for each test in TESTARRAY. |