mirror of https://github.com/docker/docs.git
Remove TestRunAutoremove
This test is already being skipped, and is also fully tested by `TestRunContainerWithRmFlagExitCodeNotEqualToZero` Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
e4cfd9b392
commit
125747e967
|
@ -4,12 +4,10 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/client"
|
|
||||||
"github.com/docker/docker/daemon"
|
"github.com/docker/docker/daemon"
|
||||||
"github.com/docker/docker/pkg/term"
|
"github.com/docker/docker/pkg/term"
|
||||||
)
|
)
|
||||||
|
@ -109,42 +107,3 @@ func assertPipe(input, output string, r io.Reader, w io.Writer, count int) error
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expected behaviour: container gets deleted automatically after exit
|
|
||||||
func TestRunAutoRemove(t *testing.T) {
|
|
||||||
t.Skip("Fixme. Skipping test for now, race condition")
|
|
||||||
stdout, stdoutPipe := io.Pipe()
|
|
||||||
|
|
||||||
cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, "", testDaemonProto, testDaemonAddr, nil)
|
|
||||||
defer cleanup(globalEngine, t)
|
|
||||||
|
|
||||||
c := make(chan struct{})
|
|
||||||
go func() {
|
|
||||||
defer close(c)
|
|
||||||
if err := cli.CmdRun("--rm", unitTestImageID, "hostname"); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
var temporaryContainerID string
|
|
||||||
setTimeout(t, "Reading command output time out", 2*time.Second, func() {
|
|
||||||
cmdOutput, err := bufio.NewReader(stdout).ReadString('\n')
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
temporaryContainerID = cmdOutput
|
|
||||||
if err := closeWrap(stdout, stdoutPipe); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
setTimeout(t, "CmdRun timed out", 10*time.Second, func() {
|
|
||||||
<-c
|
|
||||||
})
|
|
||||||
|
|
||||||
time.Sleep(500 * time.Millisecond)
|
|
||||||
|
|
||||||
if len(globalDaemon.List()) > 0 {
|
|
||||||
t.Fatalf("failed to remove container automatically: container %s still exists", temporaryContainerID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue