mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #47553 from vvoland/testing-libnetwork-rerun-flaky
hack/unit: Rerun failed flaky libnetwork tests
This commit is contained in:
@@ -327,10 +327,26 @@ Function Run-UnitTests() {
|
||||
$pkgList = $pkgList | Select-String -NotMatch "github.com/docker/docker/integration"
|
||||
$pkgList = $pkgList -replace "`r`n", " "
|
||||
|
||||
$jsonFilePath = $bundlesDir + "\go-test-report-unit-flaky-tests.json"
|
||||
$xmlFilePath = $bundlesDir + "\junit-report-unit-flaky-tests.xml"
|
||||
$coverageFilePath = $bundlesDir + "\coverage-report-unit-flaky-tests.txt"
|
||||
$goTestArg = "--rerun-fails=4 --format=standard-verbose --jsonfile=$jsonFilePath --junitfile=$xmlFilePath """ + "--packages=$pkgList" + """ -- " + $raceParm + " -coverprofile=$coverageFilePath -covermode=atomic -ldflags -w -a -test.timeout=10m -test.run=TestFlaky.*"
|
||||
Write-Host "INFO: Invoking unit tests run with $GOTESTSUM_LOCATION\gotestsum.exe $goTestArg"
|
||||
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$pinfo.FileName = "$GOTESTSUM_LOCATION\gotestsum.exe"
|
||||
$pinfo.WorkingDirectory = "$($PWD.Path)"
|
||||
$pinfo.UseShellExecute = $false
|
||||
$pinfo.Arguments = $goTestArg
|
||||
$p = New-Object System.Diagnostics.Process
|
||||
$p.StartInfo = $pinfo
|
||||
$p.Start() | Out-Null
|
||||
$p.WaitForExit()
|
||||
if ($p.ExitCode -ne 0) { Throw "Unit tests (flaky) failed" }
|
||||
|
||||
$jsonFilePath = $bundlesDir + "\go-test-report-unit-tests.json"
|
||||
$xmlFilePath = $bundlesDir + "\junit-report-unit-tests.xml"
|
||||
$coverageFilePath = $bundlesDir + "\coverage-report-unit-tests.txt"
|
||||
$goTestArg = "--format=standard-verbose --jsonfile=$jsonFilePath --junitfile=$xmlFilePath -- " + $raceParm + " -coverprofile=$coverageFilePath -covermode=atomic -ldflags -w -a """ + "-test.timeout=10m" + """ $pkgList"
|
||||
$goTestArg = "--format=standard-verbose --jsonfile=$jsonFilePath --junitfile=$xmlFilePath -- " + $raceParm + " -coverprofile=$coverageFilePath -covermode=atomic -ldflags -w -a -test.timeout=10m -test.skip=TestFlaky.*" + " $pkgList"
|
||||
Write-Host "INFO: Invoking unit tests run with $GOTESTSUM_LOCATION\gotestsum.exe $goTestArg"
|
||||
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$pinfo.FileName = "$GOTESTSUM_LOCATION\gotestsum.exe"
|
||||
|
||||
@@ -38,15 +38,38 @@ if [ -n "${base_pkg_list}" ]; then
|
||||
${base_pkg_list}
|
||||
fi
|
||||
if [ -n "${libnetwork_pkg_list}" ]; then
|
||||
rerun_flaky=1
|
||||
|
||||
gotest_extra_flags="-skip=TestFlaky.*"
|
||||
# Custom -run passed, don't run flaky tests separately.
|
||||
if echo "$TESTFLAGS" | grep -Eq '(-run|-test.run)[= ]'; then
|
||||
rerun_flaky=0
|
||||
gotest_extra_flags=""
|
||||
fi
|
||||
|
||||
# libnetwork tests invoke iptables, and cannot be run in parallel. Execute
|
||||
# tests within /libnetwork with '-p=1' to run them sequentially. See
|
||||
# https://github.com/moby/moby/issues/42458#issuecomment-873216754 for details.
|
||||
gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report-libnetwork.json --junitfile=bundles/junit-report-libnetwork.xml -- \
|
||||
"${BUILDFLAGS[@]}" \
|
||||
gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report-libnetwork.json --junitfile=bundles/junit-report-libnetwork.xml \
|
||||
-- "${BUILDFLAGS[@]}" \
|
||||
-cover \
|
||||
-coverprofile=bundles/coverage-libnetwork.out \
|
||||
-covermode=atomic \
|
||||
-p=1 \
|
||||
${gotest_extra_flags} \
|
||||
${TESTFLAGS} \
|
||||
${libnetwork_pkg_list}
|
||||
|
||||
if [ $rerun_flaky -eq 1 ]; then
|
||||
gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report-libnetwork-flaky.json --junitfile=bundles/junit-report-libnetwork-flaky.xml \
|
||||
--packages "${libnetwork_pkg_list}" \
|
||||
--rerun-fails=4 \
|
||||
-- "${BUILDFLAGS[@]}" \
|
||||
-cover \
|
||||
-coverprofile=bundles/coverage-libnetwork-flaky.out \
|
||||
-covermode=atomic \
|
||||
-p=1 \
|
||||
-test.run 'TestFlaky.*' \
|
||||
${TESTFLAGS}
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -244,7 +244,7 @@ func TestNetworkDBJoinLeaveNetworks(t *testing.T) {
|
||||
closeNetworkDBInstances(t, dbs)
|
||||
}
|
||||
|
||||
func TestNetworkDBCRUDTableEntry(t *testing.T) {
|
||||
func TestFlakyNetworkDBCRUDTableEntry(t *testing.T) {
|
||||
dbs := createNetworkDBInstances(t, 3, "node", DefaultConfig())
|
||||
|
||||
err := dbs[0].JoinNetwork("network1")
|
||||
@@ -274,7 +274,7 @@ func TestNetworkDBCRUDTableEntry(t *testing.T) {
|
||||
closeNetworkDBInstances(t, dbs)
|
||||
}
|
||||
|
||||
func TestNetworkDBCRUDTableEntries(t *testing.T) {
|
||||
func TestFlakyNetworkDBCRUDTableEntries(t *testing.T) {
|
||||
dbs := createNetworkDBInstances(t, 2, "node", DefaultConfig())
|
||||
|
||||
err := dbs[0].JoinNetwork("network1")
|
||||
@@ -344,7 +344,7 @@ func TestNetworkDBCRUDTableEntries(t *testing.T) {
|
||||
closeNetworkDBInstances(t, dbs)
|
||||
}
|
||||
|
||||
func TestNetworkDBNodeLeave(t *testing.T) {
|
||||
func TestFlakyNetworkDBNodeLeave(t *testing.T) {
|
||||
dbs := createNetworkDBInstances(t, 2, "node", DefaultConfig())
|
||||
|
||||
err := dbs[0].JoinNetwork("network1")
|
||||
@@ -830,7 +830,7 @@ func TestParallelDelete(t *testing.T) {
|
||||
closeNetworkDBInstances(t, dbs)
|
||||
}
|
||||
|
||||
func TestNetworkDBIslands(t *testing.T) {
|
||||
func TestFlakyNetworkDBIslands(t *testing.T) {
|
||||
pollTimeout := func() time.Duration {
|
||||
const defaultTimeout = 120 * time.Second
|
||||
dl, ok := t.Deadline()
|
||||
|
||||
Reference in New Issue
Block a user