Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 925fdb7

Browse files
committed
[update-integration-test] skip some test case
1 parent 5c43274 commit 925fdb7

File tree

8 files changed

+122
-101
lines changed

8 files changed

+122
-101
lines changed

integration-cli/final/cli/hyper_cli_load_local_ext_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,34 @@ func (s *DockerSuite) TestCliLoadFromLocalDocker(c *check.C) {
3333
images, _ := dockerCmd(c, "images", "hello-world")
3434
c.Assert(images, checker.Contains, "hello-world")
3535
}
36+
37+
func (s *DockerSuite) TestCliLoadFromLocalTarSize600MB(c *check.C) {
38+
printTestCaseName()
39+
defer printTestDuration(time.Now())
40+
testRequires(c, DaemonIsLinux)
41+
42+
publicURL := "http://image-tarball.s3.amazonaws.com/test/public/jenkins.tar"
43+
imagePath := fmt.Sprintf("%s/jenkins.tar", os.Getenv("IMAGE_DIR"))
44+
45+
//download image tar
46+
wgetCmd := exec.Command("wget", "-cO", imagePath, publicURL)
47+
output, exitCode, err := runCommandWithOutput(wgetCmd)
48+
c.Assert(exitCode, checker.Equals, 0)
49+
c.Assert(err, checker.IsNil)
50+
c.Assert(pathExist(imagePath), checker.Equals, true)
51+
52+
//ensure jenkins:latest not exist
53+
dockerCmdWithError("rmi", "jenkins:latest")
54+
images, _ := dockerCmd(c, "images", "jenkins:latest")
55+
c.Assert(images, checker.Not(checker.Contains), "jenkins")
56+
57+
//load image tar
58+
output, exitCode, err = dockerCmdWithError("load", "-i", imagePath)
59+
c.Assert(output, checker.Contains, "has been loaded.")
60+
c.Assert(err, checker.IsNil)
61+
c.Assert(exitCode, checker.Equals, 0)
62+
63+
//check image
64+
images, _ = dockerCmd(c, "images", "jenkins:latest")
65+
c.Assert(images, checker.Contains, "jenkins")
66+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package main
2+
3+
import (
4+
//"encoding/json"
5+
"fmt"
6+
//"io"
7+
"os"
8+
"os/exec"
9+
"regexp"
10+
"strconv"
11+
"strings"
12+
"time"
13+
14+
"github.com/docker/docker/pkg/integration/checker"
15+
"github.com/docker/docker/pkg/jsonlog"
16+
"github.com/go-check/check"
17+
)
18+
19+
//TODO: get exited container log
20+
// Regression test for #8832
21+
func (s *DockerSuite) TestCliLogsFollowSlowStdoutConsumer(c *check.C) {
22+
printTestCaseName()
23+
defer printTestDuration(time.Now())
24+
testRequires(c, DaemonIsLinux)
25+
pullImageIfNotExist("busybox")
26+
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 600000;yes X | head -c 200000`)
27+
time.Sleep(10 * time.Second)
28+
id := strings.TrimSpace(out)
29+
30+
stopSlowRead := make(chan bool)
31+
32+
go func() {
33+
exec.Command(dockerBinary, "stop", id).Run()
34+
time.Sleep(10 * time.Second)
35+
stopSlowRead <- true
36+
}()
37+
38+
logCmd := exec.Command(dockerBinary, "logs", "-f", id)
39+
stdout, err := logCmd.StdoutPipe()
40+
c.Assert(err, checker.IsNil)
41+
c.Assert(logCmd.Start(), checker.IsNil)
42+
43+
// First read slowly
44+
bytes1, err := consumeWithSpeed(stdout, 10, 50*time.Millisecond, stopSlowRead)
45+
c.Assert(err, checker.IsNil)
46+
47+
// After the container has finished we can continue reading fast
48+
bytes2, err := consumeWithSpeed(stdout, 32*1024, 0, nil)
49+
c.Assert(err, checker.IsNil)
50+
51+
actual := bytes1 + bytes2
52+
expected := 200000
53+
c.Assert(actual, checker.Equals, expected)
54+
}
55+
56+
//TODO: get exited container log
57+
func (s *DockerSuite) TestCliLogsFollowStopped(c *check.C) {
58+
printTestCaseName()
59+
defer printTestDuration(time.Now())
60+
testRequires(c, DaemonIsLinux)
61+
pullImageIfNotExist("busybox")
62+
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
63+
time.Sleep(5 * time.Second)
64+
65+
id := strings.TrimSpace(out)
66+
dockerCmd(c, "stop", id)
67+
time.Sleep(5 * time.Second)
68+
69+
logsCmd := exec.Command(dockerBinary, "logs", "-f", id)
70+
c.Assert(logsCmd.Start(), checker.IsNil)
71+
72+
errChan := make(chan error)
73+
go func() {
74+
errChan <- logsCmd.Wait()
75+
close(errChan)
76+
}()
77+
78+
select {
79+
case err := <-errChan:
80+
c.Assert(err, checker.IsNil)
81+
case <-time.After(10 * time.Second):
82+
c.Fatal("Following logs is hanged")
83+
}
84+
}

integration-cli/hyper_cli_config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func (s *DockerSuite) TestCliConfigAndRewrite(c *check.C) {
1515
defer printTestDuration(time.Now())
1616

1717
out, _ := dockerCmd(c, "config", "--accesskey", "xx", "--secretkey", "xxxx", "tcp://127.0.0.1:6443")
18-
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in /root/.hyper/config.json")
18+
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in " + homedir.Get() + "/.hyper/config.json")
1919

2020
configDir := filepath.Join(homedir.Get(), ".hyper")
2121
conf, err := cliconfig.Load(configDir)
@@ -24,7 +24,7 @@ func (s *DockerSuite) TestCliConfigAndRewrite(c *check.C) {
2424
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey, checker.Equals, "xxxx", check.Commentf("Should get xxxx, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey))
2525

2626
out, _ = dockerCmd(c, "config", "--accesskey", "yy", "--secretkey", "yyyy", "tcp://127.0.0.1:6443")
27-
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in /root/.hyper/config.json")
27+
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in " + homedir.Get() + "/.hyper/config.json")
2828

2929
conf, err = cliconfig.Load(configDir)
3030
c.Assert(err, checker.IsNil)
@@ -37,7 +37,7 @@ func (s *DockerSuite) TestCliConfigMultiHost(c *check.C) {
3737
defer printTestDuration(time.Now())
3838

3939
out, _ := dockerCmd(c, "config", "--accesskey", "xx", "--secretkey", "xxxx", "tcp://127.0.0.1:6443")
40-
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in /root/.hyper/config.json")
40+
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in " + homedir.Get() + "/.hyper/config.json")
4141

4242
configDir := filepath.Join(homedir.Get(), ".hyper")
4343
conf, err := cliconfig.Load(configDir)
@@ -46,7 +46,7 @@ func (s *DockerSuite) TestCliConfigMultiHost(c *check.C) {
4646
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey, checker.Equals, "xxxx", check.Commentf("Should get xxxx, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey))
4747

4848
out, _ = dockerCmd(c, "config", "--accesskey", "yy", "--secretkey", "yyyy", "tcp://127.0.0.1:6444")
49-
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in /root/.hyper/config.json")
49+
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in " + homedir.Get() + "/.hyper/config.json")
5050

5151
conf, err = cliconfig.Load(configDir)
5252
c.Assert(err, checker.IsNil)

integration-cli/hyper_cli_load_basic_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ func (s *DockerSuite) TestCliLoadFromUrlBasicFromInvalidUrlHost(c *check.C) {
2626
invalidHost := "invalidhost"
2727
invalidURL := "http://" + invalidHost + "/test/public/helloworld.tar"
2828
output, exitCode, err := dockerCmdWithError("load", "-i", invalidURL)
29-
c.Assert(output, checker.Equals, "Error response from daemon: Bad request parameters: Get "+invalidURL+": dial tcp: lookup invalidhost: no such host\n")
29+
c.Assert(output, checker.Contains, "Error response from daemon: Bad request parameters: Get "+invalidURL+": dial tcp: lookup invalidhost")
30+
c.Assert(output, checker.Contains, "no such host\n")
3031
c.Assert(exitCode, checker.Equals, 1)
3132
c.Assert(err, checker.NotNil)
3233
}

integration-cli/hyper_cli_load_local_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -197,37 +197,6 @@ func (s *DockerSuite) TestCliLoadFromLocalTarSize100MB(c *check.C) {
197197
c.Assert(images, checker.Contains, "nginx")
198198
}
199199

200-
func (s *DockerSuite) TestCliLoadFromLocalTarSize600MB(c *check.C) {
201-
printTestCaseName()
202-
defer printTestDuration(time.Now())
203-
testRequires(c, DaemonIsLinux)
204-
205-
publicURL := "http://image-tarball.s3.amazonaws.com/test/public/jenkins.tar"
206-
imagePath := fmt.Sprintf("%s/jenkins.tar", os.Getenv("IMAGE_DIR"))
207-
208-
//download image tar
209-
wgetCmd := exec.Command("wget", "-cO", imagePath, publicURL)
210-
output, exitCode, err := runCommandWithOutput(wgetCmd)
211-
c.Assert(exitCode, checker.Equals, 0)
212-
c.Assert(err, checker.IsNil)
213-
c.Assert(pathExist(imagePath), checker.Equals, true)
214-
215-
//ensure jenkins:latest not exist
216-
dockerCmdWithError("rmi", "jenkins:latest")
217-
images, _ := dockerCmd(c, "images", "jenkins:latest")
218-
c.Assert(images, checker.Not(checker.Contains), "jenkins")
219-
220-
//load image tar
221-
output, exitCode, err = dockerCmdWithError("load", "-i", imagePath)
222-
c.Assert(output, checker.Contains, "has been loaded.")
223-
c.Assert(err, checker.IsNil)
224-
c.Assert(exitCode, checker.Equals, 0)
225-
226-
//check image
227-
images, _ = dockerCmd(c, "images", "jenkins:latest")
228-
c.Assert(images, checker.Contains, "jenkins")
229-
}
230-
231200
func (s *DockerSuite) TestCliLoadFromLocalPullAndLoad(c *check.C) {
232201
printTestCaseName()
233202
defer printTestDuration(time.Now())

integration-cli/hyper_cli_logs_test.go

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -170,35 +170,6 @@ func (s *DockerSuite) TestCliLogsTail(c *check.C) {
170170
c.Assert(lines, checker.HasLen, testLen+1)
171171
}
172172

173-
//TODO: get exited container log
174-
func (s *DockerSuite) TestCliLogsFollowStopped(c *check.C) {
175-
printTestCaseName()
176-
defer printTestDuration(time.Now())
177-
testRequires(c, DaemonIsLinux)
178-
pullImageIfNotExist("busybox")
179-
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
180-
time.Sleep(5 * time.Second)
181-
182-
id := strings.TrimSpace(out)
183-
dockerCmd(c, "stop", id)
184-
time.Sleep(5 * time.Second)
185-
186-
logsCmd := exec.Command(dockerBinary, "logs", "-f", id)
187-
c.Assert(logsCmd.Start(), checker.IsNil)
188-
189-
errChan := make(chan error)
190-
go func() {
191-
errChan <- logsCmd.Wait()
192-
close(errChan)
193-
}()
194-
195-
select {
196-
case err := <-errChan:
197-
c.Assert(err, checker.IsNil)
198-
case <-time.After(10 * time.Second):
199-
c.Fatal("Following logs is hanged")
200-
}
201-
}
202173

203174
//TODO: fix #46
204175
func (s *DockerSuite) TestCliLogsSince(c *check.C) {
@@ -265,42 +236,6 @@ func (s *DockerSuite) TestCliLogsSinceFutureFollow(c *check.C) {
265236
}
266237
}
267238

268-
//TODO: get exited container log
269-
// Regression test for #8832
270-
func (s *DockerSuite) TestCliLogsFollowSlowStdoutConsumer(c *check.C) {
271-
printTestCaseName()
272-
defer printTestDuration(time.Now())
273-
testRequires(c, DaemonIsLinux)
274-
pullImageIfNotExist("busybox")
275-
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 600000;yes X | head -c 200000`)
276-
time.Sleep(5 * time.Second)
277-
id := strings.TrimSpace(out)
278-
279-
stopSlowRead := make(chan bool)
280-
281-
go func() {
282-
exec.Command(dockerBinary, "stop", id).Run()
283-
time.Sleep(5 * time.Second)
284-
stopSlowRead <- true
285-
}()
286-
287-
logCmd := exec.Command(dockerBinary, "logs", "-f", id)
288-
stdout, err := logCmd.StdoutPipe()
289-
c.Assert(err, checker.IsNil)
290-
c.Assert(logCmd.Start(), checker.IsNil)
291-
292-
// First read slowly
293-
bytes1, err := consumeWithSpeed(stdout, 10, 50*time.Millisecond, stopSlowRead)
294-
c.Assert(err, checker.IsNil)
295-
296-
// After the container has finished we can continue reading fast
297-
bytes2, err := consumeWithSpeed(stdout, 32*1024, 0, nil)
298-
c.Assert(err, checker.IsNil)
299-
300-
actual := bytes1 + bytes2
301-
expected := 200000
302-
c.Assert(actual, checker.Equals, expected)
303-
}
304239

305240
//TODO: fix Goroutine in multi-tenancy environment
306241
/*func (s *DockerSuite) TestCliLogsFollowGoroutinesWithStdout(c *check.C) {

integration-cli/util.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ case $1 in
9696
;;
9797
test)
9898
export DOCKER_HOST=${HYPER_HOST}
99+
export GOPATH=$GOPATH:`pwd`/../vendor
99100
mkdir -p ${IMAGE_DIR}
100101
shift
101102
if [ $# -ne 0 ];then

0 commit comments

Comments
 (0)