Add initial integration tests framework
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
9992d2e1bd
commit
cb69ab45ee
5 changed files with 662 additions and 3 deletions
58
integration-test/start_test.go
Normal file
58
integration-test/start_test.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/pkg/integration/checker"
|
||||
"github.com/go-check/check"
|
||||
)
|
||||
|
||||
func (cs *ContainerdSuite) TestStartBusyboxLsSlash(t *check.C) {
|
||||
expectedOutput := `bin
|
||||
dev
|
||||
etc
|
||||
home
|
||||
lib
|
||||
lib64
|
||||
linuxrc
|
||||
media
|
||||
mnt
|
||||
opt
|
||||
proc
|
||||
root
|
||||
run
|
||||
sbin
|
||||
sys
|
||||
tmp
|
||||
usr
|
||||
var
|
||||
`
|
||||
if err := CreateBusyboxBundle("busybox-ls-slash", []string{"ls", "/"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
c, err := cs.RunContainer("myls", "busybox-ls-slash")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Assert(c.io.stdoutBuffer.String(), checker.Equals, expectedOutput)
|
||||
}
|
||||
|
||||
func (cs *ContainerdSuite) TestStartBusyboxNoSuchFile(t *check.C) {
|
||||
expectedOutput := `oci runtime error: exec: \"NoSuchFile\": executable file not found in $PATH`
|
||||
|
||||
if err := CreateBusyboxBundle("busybox-NoSuchFile", []string{"NoSuchFile"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, err := cs.RunContainer("NoSuchFile", "busybox-NoSuchFile")
|
||||
t.Assert(err.Error(), checker.Contains, expectedOutput)
|
||||
}
|
||||
|
||||
func (cs *ContainerdSuite) TestStartBusyboxTop(t *check.C) {
|
||||
if err := CreateBusyboxBundle("busybox-top", []string{"top"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, err := cs.StartContainer("top", "busybox-top")
|
||||
t.Assert(err, checker.Equals, nil)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue