Skip to content

Commit 35011cc

Browse files
committed
test: add deamon related function
Signed-off-by: letty <[email protected]>
1 parent 1564d7a commit 35011cc

30 files changed

+661
-307
lines changed

hack/make.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function target()
118118
pouch version
119119

120120
# If test is failed, print pouch daemon log.
121-
$DIR/test/integration-test -check.v || { echo "pouch daemon log:"; cat $TMP/log; return 1; }
121+
$DIR/test/integration-test -test.v -check.v || { echo "pouch daemon log:"; cat $TMP/log; return 1; }
122122
;;
123123
*)
124124
echo "no such target: $target"

test/api_container_attach_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package main
33
import (
44
"net/url"
55

6+
"github.com/alibaba/pouch/test/command"
67
"github.com/alibaba/pouch/test/environment"
78
"github.com/alibaba/pouch/test/request"
89

910
"github.com/go-check/check"
11+
"github.com/gotestyourself/gotestyourself/icmd"
1012
)
1113

1214
// APIContainerAttachSuite is the test suite for container attach API.
@@ -19,6 +21,8 @@ func init() {
1921
// SetUpTest does common setup in the beginning of each test.
2022
func (suite *APIContainerAttachSuite) SetUpTest(c *check.C) {
2123
SkipIfFalse(c, environment.IsLinux)
24+
25+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2226
}
2327

2428
// TestContainerAttachStdin tests attaching stdin is OK.

test/api_container_create_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import (
44
"net/url"
55

66
"github.com/alibaba/pouch/apis/types"
7+
"github.com/alibaba/pouch/test/command"
78
"github.com/alibaba/pouch/test/environment"
89
"github.com/alibaba/pouch/test/request"
910

1011
"github.com/go-check/check"
12+
"github.com/gotestyourself/gotestyourself/icmd"
1113
)
1214

1315
// APIContainerCreateSuite is the test suite for container create API.
@@ -20,6 +22,7 @@ func init() {
2022
// SetUpTest does common setup in the beginning of each test.
2123
func (suite *APIContainerCreateSuite) SetUpTest(c *check.C) {
2224
SkipIfFalse(c, environment.IsLinux)
25+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2326
}
2427

2528
// TestCreateOk test create api is ok with default parameters.

test/api_container_delete_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package main
22

33
import (
4+
"github.com/alibaba/pouch/test/command"
45
"github.com/alibaba/pouch/test/environment"
56
"github.com/alibaba/pouch/test/request"
67

78
"github.com/go-check/check"
9+
"github.com/gotestyourself/gotestyourself/icmd"
810
)
911

1012
// APIContainerDeleteSuite is the test suite for container delete API.
@@ -17,6 +19,7 @@ func init() {
1719
// SetUpTest does common setup in the beginning of each test.
1820
func (suite *APIContainerDeleteSuite) SetUpTest(c *check.C) {
1921
SkipIfFalse(c, environment.IsLinux)
22+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2023
}
2124

2225
// TestDeleteNonExisting tests deleting a non-existing container return error.

test/api_container_exec_start_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import (
55
"io"
66
"net"
77

8+
"github.com/alibaba/pouch/test/command"
89
"github.com/alibaba/pouch/test/environment"
910
"github.com/alibaba/pouch/test/request"
1011

1112
"github.com/go-check/check"
13+
"github.com/gotestyourself/gotestyourself/icmd"
1214
)
1315

1416
// APIContainerExecStartSuite is the test suite for container exec start API.
@@ -21,6 +23,7 @@ func init() {
2123
// SetUpTest does common setup in the beginning of each test.
2224
func (suite *APIContainerExecStartSuite) SetUpTest(c *check.C) {
2325
SkipIfFalse(c, environment.IsLinux)
26+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2427
}
2528

2629
func checkEchoSuccess(c *check.C, conn net.Conn, br *bufio.Reader, exp string) {

test/api_container_exec_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package main
22

33
import (
4+
"github.com/alibaba/pouch/test/command"
45
"github.com/alibaba/pouch/test/environment"
56
"github.com/alibaba/pouch/test/request"
67

78
"github.com/go-check/check"
9+
"github.com/gotestyourself/gotestyourself/icmd"
810
)
911

1012
// APIContainerExecSuite is the test suite for container exec API.
@@ -17,6 +19,7 @@ func init() {
1719
// SetUpTest does common setup in the beginning of each test.
1820
func (suite *APIContainerExecSuite) SetUpTest(c *check.C) {
1921
SkipIfFalse(c, environment.IsLinux)
22+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2023
}
2124

2225
// TestContainerCreateExecOk tests execing containers is OK.

test/api_container_inspect_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ package main
22

33
import (
44
"github.com/alibaba/pouch/apis/types"
5+
"github.com/alibaba/pouch/test/command"
56
"github.com/alibaba/pouch/test/environment"
67
"github.com/alibaba/pouch/test/request"
78

89
"github.com/go-check/check"
10+
"github.com/gotestyourself/gotestyourself/icmd"
911
)
1012

1113
// APIContainerInspectSuite is the test suite for container inspect API.
@@ -18,6 +20,7 @@ func init() {
1820
// SetUpTest does common setup in the beginning of each test.
1921
func (suite *APIContainerInspectSuite) SetUpTest(c *check.C) {
2022
SkipIfFalse(c, environment.IsLinux)
23+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2124
}
2225

2326
// TestInspectNoSuchContainer tests inspecting a container that doesn't exits return error.

test/api_container_list_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package main
22

33
import (
4+
"github.com/alibaba/pouch/test/command"
45
"github.com/alibaba/pouch/test/environment"
56
"github.com/alibaba/pouch/test/request"
67

78
"github.com/go-check/check"
9+
"github.com/gotestyourself/gotestyourself/icmd"
810
)
911

1012
// APIContainerListSuite is the test suite for container list API.
@@ -17,6 +19,7 @@ func init() {
1719
// SetUpTest does common setup in the beginning of each test.
1820
func (suite *APIContainerListSuite) SetUpTest(c *check.C) {
1921
SkipIfFalse(c, environment.IsLinux)
22+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2023
}
2124

2225
// TestListOk test api is ok with default parameters.

test/api_container_pause_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package main
22

33
import (
4+
"github.com/alibaba/pouch/test/command"
45
"github.com/alibaba/pouch/test/environment"
56
"github.com/alibaba/pouch/test/request"
67

78
"github.com/go-check/check"
9+
"github.com/gotestyourself/gotestyourself/icmd"
810
)
911

1012
// APIContainerPauseSuite is the test suite for container pause/unpause API.
@@ -17,6 +19,7 @@ func init() {
1719
// SetUpTest does common setup in the beginning of each test.
1820
func (suite *APIContainerPauseSuite) SetUpTest(c *check.C) {
1921
SkipIfFalse(c, environment.IsLinux)
22+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2023
}
2124

2225
// TestPauseUnpauseOk tests a running container could be paused and unpaused.

test/api_container_rename_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package main
33
import (
44
"net/url"
55

6+
"github.com/alibaba/pouch/test/command"
67
"github.com/alibaba/pouch/test/environment"
78
"github.com/alibaba/pouch/test/request"
89

910
"github.com/go-check/check"
11+
"github.com/gotestyourself/gotestyourself/icmd"
1012
)
1113

1214
// APIContainerRenameSuite is the test suite for container create API.
@@ -19,6 +21,7 @@ func init() {
1921
// SetUpTest does common setup in the beginning of each test.
2022
func (suite *APIContainerRenameSuite) SetUpTest(c *check.C) {
2123
SkipIfFalse(c, environment.IsLinux)
24+
command.PouchRun("pull", busyboxImage).Assert(c, icmd.Success)
2225
}
2326

2427
// TestRenameOk test create api is ok with default parameters.

0 commit comments

Comments
 (0)