mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
7ac4232e70
- Make the API client library completely standalone. - Move windows partition isolation detection to the client, so the driver doesn't use external types. Signed-off-by: David Calavera <david.calavera@gmail.com>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package daemon
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
containertypes "github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/container"
|
|
)
|
|
|
|
func TestContainerDoubleDelete(t *testing.T) {
|
|
tmp, err := ioutil.TempDir("", "docker-daemon-unix-test-")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer os.RemoveAll(tmp)
|
|
daemon := &Daemon{
|
|
repository: tmp,
|
|
root: tmp,
|
|
}
|
|
daemon.containers = &contStore{s: make(map[string]*container.Container)}
|
|
|
|
container := &container.Container{
|
|
CommonContainer: container.CommonContainer{
|
|
ID: "test",
|
|
State: container.NewState(),
|
|
Config: &containertypes.Config{},
|
|
},
|
|
}
|
|
daemon.containers.Add(container.ID, container)
|
|
|
|
// Mark the container as having a delete in progress
|
|
if err := container.SetRemovalInProgress(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
// Try to remove the container when it's start is removalInProgress.
|
|
// It should ignore the container and not return an error.
|
|
if err := daemon.ContainerRm(container.ID, &types.ContainerRmConfig{ForceRemove: true}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|