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>
This commit is contained in:
Paweł Gronowski 2024-01-16 14:42:59 +01:00
parent a42726f866
commit 9de132dbf6
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -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)