From b202193ebd60ace79b9a9e5fe8bcddd84dfd5f75 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 3 Jan 2019 11:49:00 +0100 Subject: [PATCH] Don't mix t.Parallel() wth environment.ProtectAll() `testEnv` is a package-level variable, so protecting / restoring `testEnv` in parallel will result in "concurrent map write" errors. This patch removes `t.Parallel()` from tests that use this functionality (through `defer setupTest(t)()`). Note that _subtests_ can still be run in parallel, as the defer will be called after all subtests have completed. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 4d88a95d6730383624570f8730aa203a56caadc3) Signed-off-by: Sebastiaan van Stijn Upstream-commit: 05ecb140c4f3c4c7cbb860baa425104fa6f132ea Component: engine --- components/engine/integration/build/build_test.go | 2 +- components/engine/integration/container/update_linux_test.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/components/engine/integration/build/build_test.go b/components/engine/integration/build/build_test.go index 9b91ee2a38..60980c9f13 100644 --- a/components/engine/integration/build/build_test.go +++ b/components/engine/integration/build/build_test.go @@ -25,7 +25,7 @@ import ( func TestBuildWithRemoveAndForceRemove(t *testing.T) { skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME") defer setupTest(t)() - t.Parallel() + cases := []struct { name string dockerfile string diff --git a/components/engine/integration/container/update_linux_test.go b/components/engine/integration/container/update_linux_test.go index 7ebe64e7e3..eb4446c8f4 100644 --- a/components/engine/integration/container/update_linux_test.go +++ b/components/engine/integration/container/update_linux_test.go @@ -67,8 +67,6 @@ func TestUpdateMemory(t *testing.T) { } func TestUpdateCPUQuota(t *testing.T) { - t.Parallel() - defer setupTest(t)() client := request.NewAPIClient(t) ctx := context.Background()