Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace DelContainerForceOk with DelContainerForceMultyTime #1462

Merged
merged 1 commit into from
Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/api_container_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (suite *APIContainerCreateSuite) TestCreateOk(c *check.C) {
c.Assert(err, check.IsNil)
c.Assert(got.ID, check.NotNil)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestNilName tests creating container without giving name should succeed.
Expand All @@ -70,7 +70,7 @@ func (suite *APIContainerCreateSuite) TestNilName(c *check.C) {
c.Assert(got.ID, check.NotNil)
c.Assert(got.Name, check.NotNil)

DelContainerForceOk(c, got.Name)
DelContainerForceMultyTime(c, got.Name)
}

// TestDupContainer tests create a duplicate container, return 409.
Expand All @@ -96,7 +96,7 @@ func (suite *APIContainerCreateSuite) TestDupContainer(c *check.C) {

CheckRespStatus(c, resp, 409)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestNonExistingImg tests using non-existing image return 404.
Expand Down Expand Up @@ -146,7 +146,7 @@ func (suite *APIContainerCreateSuite) TestAllocateTTY(c *check.C) {
CheckRespStatus(c, resp, 201)

// TODO: verify TTY works?
DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestAddVolume tests add volume is OK.
Expand All @@ -173,7 +173,7 @@ func (suite *APIContainerCreateSuite) TestAddVolume(c *check.C) {
CheckRespStatus(c, resp, 201)

// TODO: verify volume
DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestRuntime tests specify a different runtime, e.g. runv could work.
Expand All @@ -200,7 +200,7 @@ func (suite *APIContainerCreateSuite) TestRuntime(c *check.C) {
CheckRespStatus(c, resp, 201)

// TODO: verify runtime
DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestLxcfsEnable is OK.
Expand Down Expand Up @@ -236,7 +236,7 @@ func (suite *APIContainerCreateSuite) TestLxcfsEnable(c *check.C) {

c.Assert(got.HostConfig.EnableLxcfs, check.Equals, isEnable)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestRestartPolicyAlways tests create container with restartpolicy is always could work.
Expand Down Expand Up @@ -275,7 +275,7 @@ func (suite *APIContainerCreateSuite) TestRestartPolicyAlways(c *check.C) {

c.Assert(got.HostConfig.RestartPolicy.Name, check.Equals, "always")

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestAliOSOptions tests create container with alios related container isolation options.
Expand Down
4 changes: 2 additions & 2 deletions test/api_container_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (suite *APIContainerDeleteSuite) TestDeleteRunningCon(c *check.C) {

CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestDeletePausedCon test deleting paused container return 500.
Expand All @@ -61,7 +61,7 @@ func (suite *APIContainerDeleteSuite) TestDeletePausedCon(c *check.C) {

CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestDeleteStoppedCon test deleting stopped container return 204.
Expand Down
10 changes: 5 additions & 5 deletions test/api_container_exec_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (suite *APIContainerExecSuite) TestContainerCreateExecOk(c *check.C) {
request.DecodeBody(&execCreateResp, resp.Body)
c.Logf("ExecID is %s", execCreateResp.ID)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestContainerCreateExecNoCmd tests execing containers is OK.
Expand All @@ -64,7 +64,7 @@ func (suite *APIContainerExecSuite) TestContainerCreateExecNoCmd(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 201)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestExecCreatedContainer tests creating exec on created container return error.
Expand All @@ -83,7 +83,7 @@ func (suite *APIContainerExecSuite) TestExecCreatedContainer(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestExecPausedContainer tests creating exec on paused container return error.
Expand All @@ -105,7 +105,7 @@ func (suite *APIContainerExecSuite) TestExecPausedContainer(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestExecStoppedContainer tests creating exec on stopped container return error.
Expand All @@ -127,5 +127,5 @@ func (suite *APIContainerExecSuite) TestExecStoppedContainer(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}
2 changes: 1 addition & 1 deletion test/api_container_exec_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ func (suite *APIContainerExecInspectSuite) TestContainerExecInspectOk(c *check.C
c.Assert(execInspect03.Running, check.Equals, false)
c.Assert(execInspect03.ExitCode, check.Equals, int64(0))

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}
4 changes: 2 additions & 2 deletions test/api_container_exec_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (suite *APIContainerExecStartSuite) TestContainerExecStartWithoutUpgrade(c

checkEchoSuccess(c, false, conn, br, "test")

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestContainerExecStartOk tests start exec.
Expand All @@ -81,7 +81,7 @@ func (suite *APIContainerExecStartSuite) TestContainerExecStart(c *check.C) {

checkEchoSuccess(c, false, conn, reader, "test")

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestContainerExecStartNotFound tests starting an non-existing execID return error.
Expand Down
4 changes: 2 additions & 2 deletions test/api_container_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (suite *APIContainerInspectSuite) TestInpectOk(c *check.C) {
// FinishAt time should be 0001-01-01T00:00:00Z for a non-stopped container
c.Assert(got.State.FinishedAt, check.Equals, time.Time{}.UTC().Format(time.RFC3339Nano))

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestNonExistingContainer tests inspect a non-existing container return 404.
Expand Down Expand Up @@ -81,5 +81,5 @@ func (suite *APIContainerInspectSuite) TestInspectPid(c *check.C) {

c.Assert(got.State.Pid, check.NotNil)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}
12 changes: 6 additions & 6 deletions test/api_container_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (suite *APIContainerLogsSuite) TestNoSuchContainer(c *check.C) {
func (suite *APIContainerLogsSuite) TestNoShowStdoutAndShowStderr(c *check.C) {
name := "logs_without_one_of_showstdout_and_showstderr"
command.PouchRun("run", "-d", "--name", name, busyboxImage, "ls").Assert(c, icmd.Success)
defer DelContainerForceOk(c, name)
defer DelContainerForceMultyTime(c, name)

resp, err := request.Get(fmt.Sprintf("/containers/%s/logs", name))
c.Assert(err, check.IsNil)
Expand All @@ -63,7 +63,7 @@ func (suite *APIContainerLogsSuite) TestNoShowStdoutAndShowStderr(c *check.C) {
func (suite *APIContainerLogsSuite) TestStdout(c *check.C) {
name := "logs_stdout_stream"
command.PouchRun("run", "-t", "--name", name, busyboxImage, "echo", "hello").Assert(c, icmd.Success)
defer DelContainerForceOk(c, name)
defer DelContainerForceMultyTime(c, name)

allLogs := suite.syncReadLog(c, name, map[string]string{"stdout": "1"})
c.Assert(len(allLogs), check.Equals, 1)
Expand All @@ -74,7 +74,7 @@ func (suite *APIContainerLogsSuite) TestStdout(c *check.C) {
func (suite *APIContainerLogsSuite) TestTimestamp(c *check.C) {
name := "logs_stdout_stream_with_timestamp"
command.PouchRun("run", "-t", "--name", name, busyboxImage, "echo", "hello").Assert(c, icmd.Success)
defer DelContainerForceOk(c, name)
defer DelContainerForceMultyTime(c, name)

allLogs := suite.syncReadLog(c, name, map[string]string{"stdout": "1", "timestamps": "1"})
c.Assert(len(allLogs), check.Equals, 1)
Expand All @@ -88,7 +88,7 @@ func (suite *APIContainerLogsSuite) TestTimestamp(c *check.C) {
func (suite *APIContainerLogsSuite) TestTails(c *check.C) {
name := "logs_stdout_stream_with_tails"
command.PouchRun("run", "-t", "--name", name, busyboxImage, "sh", "-c", "for i in $(seq 1 3); do echo hi$i; done").Assert(c, icmd.Success)
defer DelContainerForceOk(c, name)
defer DelContainerForceMultyTime(c, name)

allLogs := suite.syncReadLog(c, name, map[string]string{"stdout": "1", "tail": "2"})
c.Assert(len(allLogs), check.Equals, 2)
Expand All @@ -101,7 +101,7 @@ func (suite *APIContainerLogsSuite) TestTails(c *check.C) {
func (suite *APIContainerLogsSuite) TestSinceAndUntil(c *check.C) {
name := "logs_stdout_stream_with_tails"
command.PouchRun("run", "-t", "--name", name, busyboxImage, "sh", "-c", "for i in $(seq 1 3); do echo hi$i; sleep 1; done").Assert(c, icmd.Success)
defer DelContainerForceOk(c, name)
defer DelContainerForceMultyTime(c, name)

allLogs := suite.syncReadLog(c, name, map[string]string{"stdout": "1", "timestamps": "1"})
c.Assert(len(allLogs), check.Equals, 3)
Expand All @@ -126,7 +126,7 @@ func (suite *APIContainerLogsSuite) TestSinceAndUntil(c *check.C) {
func (suite *APIContainerLogsSuite) TestCheckLeakByFollowing(c *check.C) {
name := "logs_check_leak_by_following"
command.PouchRun("run", "-d", "--name", name, busyboxImage, "sh", "-c", "while true; do sleep 1; done").Assert(c, icmd.Success)
defer DelContainerForceOk(c, name)
defer DelContainerForceMultyTime(c, name)

// follow one second and check the goroutine leak
ctx, cancel := context.WithTimeout(context.TODO(), 1*time.Second)
Expand Down
4 changes: 2 additions & 2 deletions test/api_container_pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (suite *APIContainerPauseSuite) TestPauseUnpauseOk(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestNonExistingContainer tests pause a non-existing container return 404.
Expand Down Expand Up @@ -78,5 +78,5 @@ func (suite *APIContainerPauseSuite) TestNotRunningContainer(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}
6 changes: 3 additions & 3 deletions test/api_container_rename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (suite *APIContainerRenameSuite) TestRenameOk(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, newname)
DelContainerForceMultyTime(c, newname)
}

// TestRenameOk test create api is ok with default parameters.
Expand All @@ -63,7 +63,7 @@ func (suite *APIContainerRenameSuite) TestRenameById(c *check.C) {
defer resp2.Body.Close()
CheckRespStatus(c, resp2, 204)

DelContainerForceOk(c, newname)
DelContainerForceMultyTime(c, newname)

resp3, err := CreateBusyboxContainer(c, oldname, "top")
c.Assert(err, check.IsNil)
Expand All @@ -73,7 +73,7 @@ func (suite *APIContainerRenameSuite) TestRenameById(c *check.C) {
err = json.NewDecoder(resp3.Body).Decode(&ccr)
c.Assert(err, check.IsNil)

DelContainerForceOk(c, oldname)
DelContainerForceMultyTime(c, oldname)

if ccr.ID == "" {
c.Errorf("container with old name %s create error. %v", oldname, ccr)
Expand Down
6 changes: 3 additions & 3 deletions test/api_container_resize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (suite *APIContainerResizeSuite) TestContainerResizeOk(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 200)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestContainerResizeWithInvalidSize is to verify resize container with invalid size.
Expand All @@ -64,7 +64,7 @@ func (suite *APIContainerResizeSuite) TestContainerResizeWithInvalidSize(c *chec
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 400)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestResizeStoppedContainer is to verify resize a stopped container.
Expand All @@ -82,5 +82,5 @@ func (suite *APIContainerResizeSuite) TestResizeStoppedContainer(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}
6 changes: 3 additions & 3 deletions test/api_container_restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (suite *APIContainerRestartSuite) TestAPIContainerRestart(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestAPIRestartStoppedContainer it to verify restarting a stopped container.
Expand All @@ -56,7 +56,7 @@ func (suite *APIContainerRestartSuite) TestAPIRestartStoppedContainer(c *check.C
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestAPIRestartPausedContainer is to verify restarting a paused container.
Expand All @@ -75,5 +75,5 @@ func (suite *APIContainerRestartSuite) TestAPIRestartPausedContainer(c *check.C)
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}
8 changes: 4 additions & 4 deletions test/api_container_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (suite *APIContainerStartSuite) TestStartOk(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestNonExistingContainer tests start a non-existing container return 404.
Expand All @@ -58,7 +58,7 @@ func (suite *APIContainerStartSuite) TestStartStoppedContainer(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestStartPausedContainer tests start a contain in paused state will fail.
Expand All @@ -75,7 +75,7 @@ func (suite *APIContainerStartSuite) TestStartPausedContainer(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 500)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestStartDetachKeyWork test detatch-keys works.
Expand All @@ -94,7 +94,7 @@ func (suite *APIContainerStartSuite) TestStartDetachKeyWork(c *check.C) {

// TODO: check the "EOF" detatchkey really works.

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestInvalidParam tests using invalid parameter return.
Expand Down
6 changes: 3 additions & 3 deletions test/api_container_stop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (suite *APIContainerStopSuite) TestStopOk(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestNonExistingContainer tests stop a non-existing container return 404.
Expand All @@ -60,7 +60,7 @@ func (suite *APIContainerStopSuite) TestStopWait(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 204)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestInvalidParam tests using invalid parameter return.
Expand Down Expand Up @@ -95,5 +95,5 @@ func (suite *APIContainerStopSuite) TestStopPausedContainer(c *check.C) {
c.Assert(err, check.IsNil)
c.Assert(string(got.State.Status), check.Equals, "stopped")

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}
4 changes: 2 additions & 2 deletions test/api_container_wait_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (suite *APIContainerWaitSuite) TestWaitOk(c *check.C) {
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 200)

DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestWaitRunningContainer tests waiting a running container to stop, then returns 200.
Expand Down Expand Up @@ -67,7 +67,7 @@ func (suite *APIContainerWaitSuite) TestWaitRunningContainer(c *check.C) {
case <-time.After(2 * time.Second):
c.Errorf("timeout waiting for `pouch wait` API to exit")
}
DelContainerForceOk(c, cname)
DelContainerForceMultyTime(c, cname)
}

// TestWaitNonExistingContainer tests waiting a non-existing container return 404.
Expand Down
Loading