moby/pkg/plugins
Paweł Gronowski 0034a98eb1
pkg/plugins: Guard storage and unparallel racy tests
These tests were made parallel to speed up the execution, but this
turned out to be flaky, because they mutate some shared state.

The tests use shared `storage` variable without any synchronization.
However, adding synchronization is not enough in all cases, some tests
register the same plugin, so they can't be run in parallel to each
other.

This commit adds the synchronization around `storage` variable
modification and removes parallel from the tests where it's not enough.

Before:
```
$ go test -race -v . -count 1
...
--- FAIL: TestGet (15.02s)
    --- FAIL: TestGet/not_implemented (0.00s)
        testing.go:1446: race detected during execution of test
    testing.go:1446: race detected during execution of test
FAIL
FAIL    github.com/docker/docker/pkg/plugins    17.655s
FAIL
```

After:
```
$ go test -race -v . -count 1
ok      github.com/docker/docker/pkg/plugins    32.702s
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-08-04 11:22:41 +02:00
..
pluginrpc-gen pkg/plugins: format code with gofumpt 2023-06-29 00:31:52 +02:00
transport pkg/plugins/transport: remove RequestFactory interface 2023-07-25 22:38:37 +02:00
client.go pkg/plugins/transport: remove RequestFactory interface 2023-07-25 22:38:37 +02:00
client_test.go pkg/plugins: run tests with t.Parallel() 2023-07-12 22:30:46 +02:00
discovery.go pkg/plugins: make package-level socketsPath var a LocalRegistry field 2023-07-25 22:38:37 +02:00
discovery_test.go pkg/plugins: make package-level socketsPath var a LocalRegistry field 2023-07-25 22:38:37 +02:00
discovery_unix.go pkg/plugins: split exported from implementation 2023-07-25 22:38:11 +02:00
discovery_unix_test.go pkg/plugins: make package-level socketsPath var a LocalRegistry field 2023-07-25 22:38:37 +02:00
discovery_windows.go pkg/plugins: split exported from implementation 2023-07-25 22:38:11 +02:00
errors.go Add canonical import comment 2018-02-05 16:51:57 -05:00
plugin_test.go pkg/plugins: Guard storage and unparallel racy tests 2023-08-04 11:22:41 +02:00
plugins.go pkg/plugins: remove "load()" function 2023-07-25 22:38:37 +02:00