Browse Source

integration/image: Move Parallel after setupTest

setupTest should be called before Parallel as it modifies the test
environment which might produce:

```
fatal error: concurrent map writes

goroutine 143 [running]:
github.com/docker/docker/testutil/environment.(*Execution).ProtectContainer(...)
	/go/src/github.com/docker/docker/testutil/environment/protect.go:59
github.com/docker/docker/testutil/environment.ProtectContainers({0x12e8d98, 0xc00040e420}, {0x12f2878?, 0xc0004fc340}, 0xc0001fac00)
	/go/src/github.com/docker/docker/testutil/environment/protect.go:68 +0xb1
github.com/docker/docker/testutil/environment.ProtectAll({0x12e8d98, 0xc00040e210}, {0x12f2878, 0xc0004fc340}, 0xc0001fac00)
	/go/src/github.com/docker/docker/testutil/environment/protect.go:45 +0xf3
github.com/docker/docker/integration/image.setupTest(0xc0004fc340)
	/go/src/github.com/docker/docker/integration/image/main_test.go:46 +0x59
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski 1 year ago
parent
commit
9de132dbf6
1 changed files with 4 additions and 3 deletions
  1. 4 3
      integration/image/save_test.go

+ 4 - 3
integration/image/save_test.go

@@ -52,9 +52,9 @@ func tarIndexFS(t *testing.T, rdr io.Reader) fs.FS {
 }
 
 func TestSaveCheckTimes(t *testing.T) {
-	t.Parallel()
-
 	ctx := setupTest(t)
+
+	t.Parallel()
 	client := testEnv.APIClient()
 
 	const repoName = "busybox:latest"
@@ -90,11 +90,12 @@ func TestSaveCheckTimes(t *testing.T) {
 // Regression test for https://github.com/moby/moby/issues/47065
 func TestSaveCheckManifestLayers(t *testing.T) {
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.44"), "OCI layout support was introduced in v25")
-	t.Parallel()
 
 	ctx := setupTest(t)
 	client := testEnv.APIClient()
 
+	t.Parallel()
+
 	const repoName = "busybox:latest"
 	img, _, err := client.ImageInspectWithRaw(ctx, repoName)
 	assert.NilError(t, err)