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

Commit 8cd0b04

Browse files
committed
[markup-basic-test-case] markup basic test case
1 parent 2059080 commit 8cd0b04

32 files changed

+471
-199
lines changed

integration-cli/hyper_cli_config_test.go

100755100644
Lines changed: 5 additions & 5 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 " + homedir.Get() + "/.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,20 +24,20 @@ 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 " + homedir.Get() + "/.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)
3131
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].AccessKey, checker.Equals, "yy", check.Commentf("Should get yy, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].AccessKey))
3232
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey, checker.Equals, "yyyy", check.Commentf("Should get yyyy, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey))
3333
}
3434

35-
func (s *DockerSuite) TestCliConfigMultiHost(c *check.C) {
35+
func (s *DockerSuite) TestCliConfigMultiHostBasic(c *check.C) {
3636
printTestCaseName()
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 " + homedir.Get() + "/.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 " + homedir.Get() + "/.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_create_test.go

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (s *DockerSuite) TestCliCreateArgs(c *check.C) {
5858
}
5959

6060
// Make sure we can set hostconfig options too
61-
func (s *DockerSuite) TestCliCreateHostConfig(c *check.C) {
61+
func (s *DockerSuite) TestCliCreateHostConfigBasic(c *check.C) {
6262
printTestCaseName()
6363
defer printTestDuration(time.Now())
6464
pullImageIfNotExist("busybox")
@@ -84,7 +84,7 @@ func (s *DockerSuite) TestCliCreateHostConfig(c *check.C) {
8484
}
8585

8686
// "test123" should be printed by docker create + start
87-
func (s *DockerSuite) TestCliCreateEchoStdout(c *check.C) {
87+
func (s *DockerSuite) TestCliCreateEchoStdoutBasic(c *check.C) {
8888
printTestCaseName()
8989
defer printTestDuration(time.Now())
9090
pullImageIfNotExist("busybox")

integration-cli/hyper_cli_exec_test.go

100755100644
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func (s *DockerSuite) TestCliExecBasic(c *check.C) {
2323
defer printTestDuration(time.Now())
2424

2525
testRequires(c, DaemonIsLinux)
26+
pullImageIfNotExist("busybox")
2627
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "sh", "-c", "echo test > /tmp/file && top")
2728

2829
out, _ := dockerCmd(c, "exec", "test", "cat", "/tmp/file")

integration-cli/hyper_cli_exec_unix_test.go

100755100644
File mode changed.

integration-cli/hyper_cli_fip_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/go-check/check"
99
)
1010

11-
func (s *DockerSuite) TestCliFipAssociateUsedIP(c *check.C) {
11+
func (s *DockerSuite) TestCliFipAssociateUsedIPBasic(c *check.C) {
1212
printTestCaseName()
1313
defer printTestDuration(time.Now())
1414

integration-cli/hyper_cli_help_test.go

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/go-check/check"
1414
)
1515

16-
func (s *DockerSuite) TestCliHelpTextVerify(c *check.C) {
16+
func (s *DockerSuite) TestCliHelpTextVerifyBasic(c *check.C) {
1717
printTestCaseName()
1818
defer printTestDuration(time.Now())
1919

integration-cli/hyper_cli_history_test.go

100755100644
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ RUN echo "Z"`,
6363
6464
}*/
6565

66-
func (s *DockerSuite) TestCliHistoryExistentImage(c *check.C) {
66+
func (s *DockerSuite) TestCliHistoryExistentImageBasic(c *check.C) {
6767
printTestCaseName()
6868
defer printTestDuration(time.Now())
6969

7070
pullImageIfNotExist("busybox")
71-
dockerCmd(c, "history", "busybox")
71+
_, _, err := dockerCmdWithError("history", "busybox")
72+
c.Assert(err, check.IsNil, check.Commentf("history on a existent image should not fail."))
7273
}
7374

7475
func (s *DockerSuite) TestCliHistoryNonExistentImage(c *check.C) {

integration-cli/hyper_cli_info_test.go

100755100644
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ package main
22

33
import (
44
"fmt"
5-
// "net"
65
"strings"
76
"time"
87

98
"github.com/docker/docker/pkg/integration/checker"
10-
// "github.com/docker/docker/utils"
119
"github.com/go-check/check"
1210
)
1311

1412
// ensure docker info succeeds
15-
func (s *DockerSuite) TestCliInfoEnsureSucceeds(c *check.C) {
16-
printTestCaseName(); defer printTestDuration(time.Now())
13+
func (s *DockerSuite) TestCliInfoEnsureSucceedsBasic(c *check.C) {
14+
printTestCaseName()
15+
defer printTestDuration(time.Now())
1716
out, _ := dockerCmd(c, "info")
1817

1918
// always shown fields
@@ -47,7 +46,6 @@ func (s *DockerSuite) TestCliInfoEnsureSucceeds(c *check.C) {
4746
}
4847
}
4948

50-
5149
//comment: not support discoveryBackend
5250
//// TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and
5351
//// `--cluster-store` properly show the backend's endpoint in info output.
@@ -68,7 +66,6 @@ func (s *DockerSuite) TestCliInfoEnsureSucceeds(c *check.C) {
6866
// c.Assert(out, checker.Contains, fmt.Sprintf("Cluster advertise: %s\n", discoveryAdvertise))
6967
//}
7068

71-
7269
//comment: not support discoveryBackend
7370
//// TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with
7471
//// an invalid `--cluster-advertise` configuration
@@ -88,7 +85,6 @@ func (s *DockerSuite) TestCliInfoEnsureSucceeds(c *check.C) {
8885
// c.Assert(err, checker.Not(checker.IsNil))
8986
//}
9087

91-
9288
//comment: not support discoveryBackend
9389
//// TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise`
9490
//// configured with interface name properly show the advertise ip-address in info output.
@@ -118,10 +114,12 @@ func (s *DockerSuite) TestCliInfoEnsureSucceeds(c *check.C) {
118114
// c.Assert(out, checker.Contains, fmt.Sprintf("Cluster advertise: %s:2375\n", ip.String()))
119115
//}
120116

121-
func (s *DockerSuite) TestCliInfoDisplaysRunningContainers(c *check.C) {
122-
printTestCaseName(); defer printTestDuration(time.Now())
117+
func (s *DockerSuite) TestCliInfoDisplaysRunningContainersBasic(c *check.C) {
118+
printTestCaseName()
119+
defer printTestDuration(time.Now())
123120
testRequires(c, DaemonIsLinux)
124121

122+
pullImageIfNotExist("busybox")
125123
dockerCmd(c, "run", "-d", "busybox", "top")
126124
out, _ := dockerCmd(c, "info")
127125
c.Assert(out, checker.Contains, fmt.Sprintf("Containers: %d\n", 1))
@@ -148,12 +146,14 @@ func (s *DockerSuite) TestCliInfoDisplaysRunningContainers(c *check.C) {
148146
//}
149147

150148
func (s *DockerSuite) TestCliInfoDisplaysStoppedContainers(c *check.C) {
151-
printTestCaseName(); defer printTestDuration(time.Now())
149+
printTestCaseName()
150+
defer printTestDuration(time.Now())
152151
testRequires(c, DaemonIsLinux)
153152

153+
pullImageIfNotExist("busybox")
154154
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
155155
outAry := strings.Split(out, "\n")
156-
c.Assert(len(outAry), checker.GreaterOrEqualThan,2)
156+
c.Assert(len(outAry), checker.GreaterOrEqualThan, 2)
157157
cleanedContainerID := outAry[len(outAry)-2]
158158

159159
dockerCmd(c, "stop", cleanedContainerID)

integration-cli/hyper_cli_inspect_experimental_test.go

100755100644
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
package main
22

33
import (
4+
"time"
5+
46
"github.com/docker/docker/pkg/integration/checker"
57
"github.com/docker/engine-api/types"
68
"github.com/go-check/check"
79
)
810

9-
func (s *DockerSuite) TestCliInspectNamedMountPoint(c *check.C) {
11+
func (s *DockerSuite) TestCliInspectNamedMountPointBasic(c *check.C) {
12+
printTestCaseName()
13+
defer printTestDuration(time.Now())
1014
testRequires(c, DaemonIsLinux)
15+
16+
pullImageIfNotExist("busybox")
1117
dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:/data", "busybox", "cat")
1218

1319
vol := inspectFieldJSON(c, "test", "Mounts")

integration-cli/hyper_cli_inspect_test.go

100755100644
Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ func checkValidGraphDriver(c *check.C, name string) {
1818
}
1919
}
2020

21-
func (s *DockerSuite) TestCliInspectImage(c *check.C) {
21+
func (s *DockerSuite) TestCliInspectImageBasic(c *check.C) {
2222
printTestCaseName()
2323
defer printTestDuration(time.Now())
2424
testRequires(c, DaemonIsLinux)
25+
2526
imageTest := "busybox:1.26.2"
2627
ensureImageExist(c, imageTest)
2728
// It is important that this ID remain stable. If a code change causes
@@ -41,6 +42,7 @@ func (s *DockerSuite) TestCliInspectInt64(c *check.C) {
4142
defer printTestDuration(time.Now())
4243
testRequires(c, DaemonIsLinux)
4344

45+
pullImageIfNotExist("busybox")
4446
dockerCmd(c, "run", "-d", "--name", "inspect-test", "busybox", "true")
4547
inspectOut := inspectField(c, "inspect-test", "HostConfig.Memory")
4648
c.Assert(inspectOut, checker.Equals, "0")
@@ -53,18 +55,21 @@ func (s *DockerSuite) TestCliInspectDefault(c *check.C) {
5355
//Both the container and image are named busybox. docker inspect will fetch the container JSON.
5456
//If the container JSON is not available, it will go for the image JSON.
5557

58+
pullImageIfNotExist("busybox")
5659
out, _ := dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
5760
containerID := getIDfromOutput(c, out)
5861

5962
inspectOut := inspectField(c, "busybox", "Id")
6063
c.Assert(strings.TrimSpace(inspectOut), checker.Equals, containerID)
6164
}
6265

63-
func (s *DockerSuite) TestCliInspectStatus(c *check.C) {
66+
func (s *DockerSuite) TestCliInspectStatusBasic(c *check.C) {
6467
printTestCaseName()
6568
defer printTestDuration(time.Now())
6669
// defer unpauseAllContainers()
6770
testRequires(c, DaemonIsLinux)
71+
72+
pullImageIfNotExist("busybox")
6873
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
6974
out = getIDfromOutput(c, out)
7075

@@ -84,6 +89,7 @@ func (s *DockerSuite) TestCliInspectTypeFlagContainer(c *check.C) {
8489
//Both the container and image are named busybox. docker inspect will fetch container
8590
//JSON State.Running field. If the field is true, it's a container.
8691

92+
pullImageIfNotExist("busybox")
8793
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
8894

8995
formatStr := "--format='{{.State.Running}}'"
@@ -99,6 +105,7 @@ func (s *DockerSuite) TestCliInspectTypeFlagWithNoContainer(c *check.C) {
99105
//JSON. Since there is no container named busybox and --type=container, docker inspect will
100106
//not try to get the image JSON. It will throw an error.
101107

108+
pullImageIfNotExist("busybox")
102109
dockerCmd(c, "run", "-d", "busybox", "true")
103110

104111
_, _, err := dockerCmdWithError("inspect", "--type=container", "busybox")
@@ -114,6 +121,7 @@ func (s *DockerSuite) TestCliInspectTypeFlagWithImage(c *check.C) {
114121
//JSON as --type=image. if there is no image with name busybox, docker inspect
115122
//will throw an error.
116123

124+
pullImageIfNotExist("busybox")
117125
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
118126

119127
out, _ := dockerCmd(c, "inspect", "--type=image", "busybox")
@@ -127,6 +135,7 @@ func (s *DockerSuite) TestCliInspectTypeFlagWithInvalidValue(c *check.C) {
127135
//Both the container and image are named busybox. docker inspect will fail
128136
//as --type=foobar is not a valid value for the flag.
129137

138+
pullImageIfNotExist("busybox")
130139
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
131140

132141
out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
@@ -139,6 +148,7 @@ func (s *DockerSuite) TestCliInspectImageFilterInt(c *check.C) {
139148
printTestCaseName()
140149
defer printTestDuration(time.Now())
141150
testRequires(c, DaemonIsLinux)
151+
142152
imageTest := "busybox"
143153
ensureImageExist(c, imageTest)
144154
out := inspectField(c, imageTest, "Size")
@@ -154,10 +164,12 @@ func (s *DockerSuite) TestCliInspectImageFilterInt(c *check.C) {
154164
c.Assert(result, checker.Equals, true)
155165
}
156166

157-
func (s *DockerSuite) TestCliInspectContainerFilterInt(c *check.C) {
167+
func (s *DockerSuite) TestCliInspectContainerFilterIntBasic(c *check.C) {
158168
printTestCaseName()
159169
defer printTestDuration(time.Now())
160170
testRequires(c, DaemonIsLinux)
171+
172+
pullImageIfNotExist("busybox")
161173
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
162174
id := getIDfromOutput(c, out)
163175

@@ -178,6 +190,7 @@ func (s *DockerSuite) TestCliInspectImageGraphDriver(c *check.C) {
178190
printTestCaseName()
179191
defer printTestDuration(time.Now())
180192
testRequires(c, DaemonIsLinux)
193+
181194
imageTest := "busybox"
182195
ensureImageExist(c, imageTest)
183196
name := inspectField(c, imageTest, "GraphDriver.Name")
@@ -204,6 +217,8 @@ func (s *DockerSuite) TestCliInspectTimesAsRFC3339Nano(c *check.C) {
204217
printTestCaseName()
205218
defer printTestDuration(time.Now())
206219
testRequires(c, DaemonIsLinux)
220+
221+
pullImageIfNotExist("busybox")
207222
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
208223
id := getIDfromOutput(c, out)
209224

@@ -229,6 +244,8 @@ func (s *DockerSuite) TestCliInspectLogConfigNoType(c *check.C) {
229244
printTestCaseName()
230245
defer printTestDuration(time.Now())
231246
testRequires(c, DaemonIsLinux)
247+
248+
pullImageIfNotExist("busybox")
232249
dockerCmd(c, "create", "--name=test", "busybox")
233250
var logConfig container.LogConfig
234251

@@ -248,6 +265,7 @@ func (s *DockerSuite) TestCliInspectNoSizeFlagContainer(c *check.C) {
248265
//Both the container and image are named busybox. docker inspect will fetch container
249266
//JSON SizeRw and SizeRootFs field. If there is no flag --size/-s, there are no size fields.
250267

268+
pullImageIfNotExist("busybox")
251269
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
252270

253271
formatStr := "--format='{{.SizeRw}},{{.SizeRootFs}}'"
@@ -258,6 +276,8 @@ func (s *DockerSuite) TestCliInspectNoSizeFlagContainer(c *check.C) {
258276
func (s *DockerSuite) TestCliInspectSizeFlagContainer(c *check.C) {
259277
printTestCaseName()
260278
defer printTestDuration(time.Now())
279+
280+
pullImageIfNotExist("busybox")
261281
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
262282

263283
formatStr := "--format='{{.SizeRw}},{{.SizeRootFs}}'"
@@ -271,6 +291,8 @@ func (s *DockerSuite) TestCliInspectSizeFlagContainer(c *check.C) {
271291
func (s *DockerSuite) TestCliInspectSizeFlagImage(c *check.C) {
272292
printTestCaseName()
273293
defer printTestDuration(time.Now())
294+
295+
pullImageIfNotExist("busybox")
274296
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
275297

276298
formatStr := "--format='{{.SizeRw}},{{.SizeRootFs}}'"
@@ -285,8 +307,9 @@ func (s *DockerSuite) TestCliInspectSizeFlagImage(c *check.C) {
285307
func (s *DockerSuite) TestCliInspectTempateError(c *check.C) {
286308
printTestCaseName()
287309
defer printTestDuration(time.Now())
288-
// Template parsing error for both the container and image.
289310

311+
// Template parsing error for both the container and image.
312+
pullImageIfNotExist("busybox")
290313
dockerCmd(c, "run", "--name=container1", "-d", "busybox", "top")
291314

292315
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='Format container: {{.ThisDoesNotExist}}'", "container1")
@@ -301,6 +324,8 @@ func (s *DockerSuite) TestCliInspectTempateError(c *check.C) {
301324
func (s *DockerSuite) TestCliInspectJSONFields(c *check.C) {
302325
printTestCaseName()
303326
defer printTestDuration(time.Now())
327+
328+
pullImageIfNotExist("busybox")
304329
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
305330
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='{{.HostConfig.Dns}}'", "busybox")
306331

@@ -311,6 +336,7 @@ func (s *DockerSuite) TestCliInspectJSONFields(c *check.C) {
311336
func (s *DockerSuite) TestCliInspectByPrefix(c *check.C) {
312337
printTestCaseName()
313338
defer printTestDuration(time.Now())
339+
314340
imageTest := "busybox"
315341
ensureImageExist(c, imageTest)
316342
id := inspectField(c, imageTest, "Id")
@@ -326,6 +352,8 @@ func (s *DockerSuite) TestCliInspectByPrefix(c *check.C) {
326352
func (s *DockerSuite) TestCliInspectStopWhenNotFound(c *check.C) {
327353
printTestCaseName()
328354
defer printTestDuration(time.Now())
355+
356+
pullImageIfNotExist("busybox")
329357
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
330358
dockerCmd(c, "run", "--name=not-shown", "-d", "busybox", "top")
331359
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='{{.Name}}'", "busybox", "missing", "not-shown")

0 commit comments

Comments
 (0)