Browse code

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

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2019/02/08 09:37:41
Showing 1 changed files
... ...
@@ -19,8 +19,19 @@ echo "Running stress test for them."
19 19
 
20 20
 (
21 21
     TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
22
-    export TESTFLAGS="-test.count 5 -test.run ${TESTARRAY%?}"
22
+    # Note: TEST_REPEAT will make the test suite run 5 times, restarting the daemon
23
+    # whereas testcount will make each test run 5 times in a row under the same daemon.
24
+    # This will make a total of 25 runs for each test in TESTARRAY.
23 25
     export TEST_REPEAT=5
26
+    local testcount=5
27
+    # However, TIMEOUT needs to take testcount into account, or a premature time out may happen.
28
+    # The following ugliness will:
29
+    # - remove last character (usually 'm' from '10m')
30
+    # - multiply by testcount
31
+    # - add last character back
32
+    export TIMEOUT=$((${TIMEOUT::-1} * $testcount))${TIMEOUT:$((${#TIMEOUT}-1)):1}
33
+
34
+    export TESTFLAGS="-test.count $testcount -test.run ${TESTARRAY%?}"
24 35
     echo "Using test flags: $TESTFLAGS"
25 36
     source hack/make/test-integration
26 37
 )