mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Improve TestKillDifferentUser to prevent timeout on buildbot
This commit is contained in:
parent
6178dc7f1b
commit
db9d68c3e4
1 changed files with 14 additions and 7 deletions
|
@ -401,9 +401,11 @@ func TestOutput(t *testing.T) {
|
|||
func TestKillDifferentUser(t *testing.T) {
|
||||
runtime := mkRuntime(t)
|
||||
defer nuke(runtime)
|
||||
|
||||
container, err := NewBuilder(runtime).Create(&Config{
|
||||
Image: GetTestImage(runtime).ID,
|
||||
Cmd: []string{"tail", "-f", "/etc/resolv.conf"},
|
||||
Cmd: []string{"cat"},
|
||||
OpenStdin: true,
|
||||
User: "daemon",
|
||||
},
|
||||
)
|
||||
|
@ -411,12 +413,12 @@ func TestKillDifferentUser(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
defer runtime.Destroy(container)
|
||||
defer container.stdin.Close()
|
||||
|
||||
if container.State.Running {
|
||||
t.Errorf("Container shouldn't be running")
|
||||
}
|
||||
hostConfig := &HostConfig{}
|
||||
if err := container.Start(hostConfig); err != nil {
|
||||
if err := container.Start(&HostConfig{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -426,8 +428,13 @@ func TestKillDifferentUser(t *testing.T) {
|
|||
}
|
||||
})
|
||||
|
||||
// Even if the state is running, lets give some time to lxc to spawn the process
|
||||
container.WaitTimeout(500 * time.Millisecond)
|
||||
setTimeout(t, "read/write assertion timed out", 2*time.Second, func() {
|
||||
out, _ := container.StdoutPipe()
|
||||
in, _ := container.StdinPipe()
|
||||
if err := assertPipe("hello\n", "hello", out, in, 15); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
})
|
||||
|
||||
if err := container.Kill(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
Loading…
Reference in a new issue