DockerCLI/cli/command
Sebastiaan van Stijn 9688f62d20
fix race condition in TestRemoveForce
This test uses two subtests that were sharing the same variable.
Subtests run in a goroutine, which could lead to them concurrently
accessing the variable, resulting in a panic:

    === FAIL: cli/command/container TestRemoveForce/without_force (0.00s)
    Error: Error: No such container: nosuchcontainer
        --- FAIL: TestRemoveForce/without_force (0.00s)
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    	panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x40393f]
    goroutine 190 [running]:
    testing.tRunner.func1.2({0xb76380, 0x124c9a0})
    	/usr/local/go/src/testing/testing.go:1389 +0x24e
    testing.tRunner.func1()
    	/usr/local/go/src/testing/testing.go:1392 +0x39f
    panic({0xb76380, 0x124c9a0})
    	/usr/local/go/src/runtime/panic.go:838 +0x207
    sort.StringSlice.Less(...)
    	/usr/local/go/src/sort/sort.go:319
    sort.insertionSort({0xd87380, 0xc00051b3b0}, 0x0, 0x2)
    	/usr/local/go/src/sort/sort.go:40 +0xb1
    sort.quickSort({0xd87380, 0xc00051b3b0}, 0x18?, 0xb4f060?, 0xc000540e01?)
    	/usr/local/go/src/sort/sort.go:222 +0x171
    sort.Sort({0xd87380, 0xc00051b3b0})
    	/usr/local/go/src/sort/sort.go:231 +0x53
    sort.Strings(...)
    	/usr/local/go/src/sort/sort.go:335
    github.com/docker/cli/cli/command/container.TestRemoveForce.func2(0xc0005389c0?)
    	/go/src/github.com/docker/cli/cli/command/container/rm_test.go:36 +0x125
    testing.tRunner(0xc00053e4e0, 0xc00051b140)
    	/usr/local/go/src/testing/testing.go:1439 +0x102
    created by testing.(*T).Run
    	/usr/local/go/src/testing/testing.go:1486 +0x35f
    === FAIL: cli/command/container TestRemoveForce (0.00s)

This patch changes the test to use to separate variables.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-31 22:54:17 +02:00
..
builder Fix builder prune -a/--all flag description 2020-02-18 14:30:28 +01:00
checkpoint cli/command/checkpoint: remove deprecated io/ioutil 2022-02-25 15:35:51 +01:00
commands Remove "docker engine" subcommands 2019-12-12 17:51:25 +01:00
config linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
container fix race condition in TestRemoveForce 2022-03-31 22:54:17 +02:00
context Output compact JSON by default for --format=json 2022-03-15 15:42:35 +01:00
formatter linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
idresolver bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-23 00:28:55 +01:00
image linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
inspect linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
manifest cli/registry/client: remove unused RegistryClient.GetTags() 2022-03-30 20:00:34 +02:00
network linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
node linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
plugin linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
registry search: remove client-side default for --limit 2022-03-30 10:05:43 +02:00
secret linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
service linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
stack linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
swarm cli/command/swarm: remove deprecated io/ioutil and use t.TempDir() 2022-02-25 15:42:11 +01:00
system vendor: github.com/docker/docker 8941dcfcc5db4aefc351cd5b5bb4d524823035c0 2022-03-28 17:21:59 +02:00
task linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
testdata Dynamically register kubernetes context store endpoint type. 2019-05-20 13:28:11 +01:00
trust linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
volume linting: fix incorrectly formatted errors (revive) 2022-03-28 10:37:25 +02:00
cli.go Merge pull request #3136 from thaJeztah/remove_clientinfo 2022-03-15 15:12:22 +01:00
cli_options.go Implement WithDefaultContextStoreConfig() DockerCliOption 2022-03-03 14:47:59 +01:00
cli_options_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-23 00:28:55 +01:00
cli_test.go Merge pull request #3136 from thaJeztah/remove_clientinfo 2022-03-15 15:12:22 +01:00
context.go remove obsolete mutli-orchestrator support 2022-02-22 15:28:12 +01:00
context_test.go remove obsolete mutli-orchestrator support 2022-02-22 15:28:12 +01:00
defaultcontextstore.go remove obsolete mutli-orchestrator support 2022-02-22 15:28:12 +01:00
defaultcontextstore_test.go cli/command: remove deprecated io/ioutil and use t.TempDir() 2022-02-25 15:42:14 +01:00
events_utils.go updated vendoring 2017-09-01 19:41:06 -04:00
registry.go registry: don't call "/info" API endpoint to get default registry 2022-03-15 16:30:42 +01:00
registry_test.go registry: don't call "/info" API endpoint to get default registry 2022-03-15 16:30:42 +01:00
streams.go Extract streams helpers from command package to their own package to remove a cyclic dependency from command to internal/containerizedengine 2019-01-28 14:36:00 +01:00
trust.go Refactor content_trust cli/flags handling 2018-03-08 15:00:43 -05:00
utils.go build: remove PersistentPreRunE hack for experimental --platform 2020-11-16 14:58:11 +01:00
utils_test.go cli/command: remove deprecated io/ioutil and use t.TempDir() 2022-02-25 15:42:14 +01:00