Skip to content

Commit

Permalink
Merge pull request hyperhq#358 from YaoZengzeng/test-kill
Browse files Browse the repository at this point in the history
integration test for kill KILL
  • Loading branch information
laijs authored Oct 9, 2016
2 parents 8b19c0e + 9bcf774 commit 23fcd90
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions integration-test/kill_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package main

import (
"strings"
"time"

"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
)

func (s *RunVSuite) TestKillKILL(c *check.C) {
ctrName := "testKillKILL"
spec := defaultTestSpec
c.Assert(s.addSpec(&spec), checker.IsNil)
exitChan := make(chan struct{}, 0)

go func() {
defer close(exitChan)
_, exitCode := s.runvCommand(c, "start", "--bundle", s.bundlePath, ctrName)
c.Assert(exitCode, checker.Equals, 0)
}()

for count := 0; count < 10; count++ {
_, exitCode, err := s.runvCommandWithError("state", ctrName)
if exitCode == 0 {
c.Assert(err, checker.IsNil)
break
}
time.Sleep(1 * time.Second)
}

_, exitCode := s.runvCommand(c, "kill", ctrName, "KILL")
c.Assert(exitCode, checker.Equals, 0)

timeout := true
for count := 0; count < 10; count++ {
out, exitCode := s.runvCommand(c, "list")
c.Assert(exitCode, checker.Equals, 0)
if strings.Contains(out, ctrName) {
timeout = false
break
}
time.Sleep(1 * time.Second)
}
c.Assert(timeout, checker.Equals, false)
<-exitChan
}

0 comments on commit 23fcd90

Please sign in to comment.