github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/make/test-integration-flaky (about)

     1  #!/usr/bin/env bash
     2  set -e -o pipefail
     3  
     4  source hack/validate/.validate
     5  
     6  run_integration_flaky() {
     7  	new_tests=$(
     8  		validate_diff --diff-filter=ACMR --unified=0 -- 'integration/*_test.go' \
     9  			| grep -E '^(\+func Test)(.*)(\*testing\.T\))' || true
    10  	)
    11  
    12  	if [ -z "$new_tests" ]; then
    13  		echo 'No new tests added to integration.'
    14  		return
    15  	fi
    16  
    17  	echo
    18  	echo "Found new integrations tests:"
    19  	echo "$new_tests"
    20  	echo "Running stress test for them."
    21  
    22  	(
    23  		TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
    24  		# Note: TEST_REPEAT will make the test suite run 5 times, restarting the daemon
    25  		# and each test will run 5 times in a row under the same daemon.
    26  		# This will make a total of 25 runs for each test in TESTARRAY.
    27  		export TEST_REPEAT=5
    28  		export TESTFLAGS="-test.count ${TEST_REPEAT} -test.run ${TESTARRAY%?}"
    29  		echo "Using test flags: $TESTFLAGS"
    30  		source hack/make/test-integration
    31  	)
    32  }
    33  
    34  run_integration_flaky