Forráskód Böngészése

hack: Have TIMEOUT take -test.count into account when testing for flakiness

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 42dcfc894a64e9b4c1751b21db1537b3b68a36d8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Tibor Vass 6 éve
szülő
commit
a9c1bfc1b1
1 módosított fájl, 12 hozzáadás és 1 törlés
  1. 12 1
      hack/make/test-integration-flaky

+ 12 - 1
hack/make/test-integration-flaky

@@ -19,8 +19,19 @@ echo "Running stress test for them."
 
 
 (
 (
     TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
     TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
-    export TESTFLAGS="-test.count 5 -test.run ${TESTARRAY%?}"
+    # Note: TEST_REPEAT will make the test suite run 5 times, restarting the daemon
+    # whereas testcount will make each test run 5 times in a row under the same daemon.
+    # This will make a total of 25 runs for each test in TESTARRAY.
     export TEST_REPEAT=5
     export TEST_REPEAT=5
+    local testcount=5
+    # However, TIMEOUT needs to take testcount into account, or a premature time out may happen.
+    # The following ugliness will:
+    # - remove last character (usually 'm' from '10m')
+    # - multiply by testcount
+    # - add last character back
+    export TIMEOUT=$((${TIMEOUT::-1} * $testcount))${TIMEOUT:$((${#TIMEOUT}-1)):1}
+
+    export TESTFLAGS="-test.count $testcount -test.run ${TESTARRAY%?}"
     echo "Using test flags: $TESTFLAGS"
     echo "Using test flags: $TESTFLAGS"
     source hack/make/test-integration
     source hack/make/test-integration
 )
 )