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

Commit 6737547

Browse files
committed
[region] update integration-cli, change --host to --region
1 parent e32badf commit 6737547

12 files changed

+49
-46
lines changed

Dockerfile.qa

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ENV BRANCH="master"
3333

3434
ENV ACCESS_KEY=
3535
ENV SECRET_KEY=
36+
ENV REGION=
3637

3738
RUN mkdir -p /go/src/github.com/hyperhq
3839
WORKDIR /go/src/github.com/hyperhq

hack/generate-hyper-conf-dev.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ if [ "$@" != "./build.sh" ];then
88
"clouds": {
99
"${DOCKER_HOST}": {
1010
"accesskey": "${ACCESS_KEY}",
11-
"secretkey": "${SECRET_KEY}"
11+
"secretkey": "${SECRET_KEY}",
12+
"region": "${REGION}"
1213
}
1314
}
1415
}

hack/generate-hyper-conf-qa.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ if [[ "$@" != "./build.sh" ]];then
3232
"clouds": {
3333
"${DOCKER_HOST}": {
3434
"accesskey": "${ACCESS_KEY}",
35-
"secretkey": "${SECRET_KEY}"
35+
"secretkey": "${SECRET_KEY}",
36+
"region": "${REGION}"
3637
}
3738
}
3839
}

integration-cli/docker_hub_pull_suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ func (s *DockerHubPullSuite) CmdWithError(name string, arg ...string) (string, e
8686

8787
// MakeCmd returns a exec.Cmd command to run against the suite daemon.
8888
func (s *DockerHubPullSuite) MakeCmd(name string, arg ...string) *exec.Cmd {
89-
//args := []string{"--host", s.d.sock(), name}
90-
args := []string{"--host", os.Getenv("DOCKER_HOST"), name}
89+
//args := []string{"--region", s.d.sock(), name}
90+
args := []string{"--region", os.Getenv("DOCKER_HOST"), name}
9191
args = append(args, arg...)
9292
return exec.Command(dockerBinary, args...)
9393
}

integration-cli/docker_utils.go

100755100644
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func init() {
112112

113113
//set flag_host
114114
if os.Getenv("DOCKER_HOST") != "" {
115-
flag_host = "--host=" + os.Getenv("DOCKER_HOST")
115+
flag_host = "--region=" + os.Getenv("DOCKER_HOST")
116116
}
117117
}
118118

@@ -242,7 +242,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
242242
fmt.Sprintf("--userland-proxy=%t", d.userlandProxy),
243243
)
244244
if !(d.useDefaultHost || d.useDefaultTLSHost) {
245-
args = append(args, []string{"--host", os.Getenv("DOCKER_HOST")}...)
245+
args = append(args, []string{"--region", os.Getenv("DOCKER_HOST")}...)
246246
}
247247
if root := os.Getenv("DOCKER_REMAP_ROOT"); root != "" {
248248
args = append(args, []string{"--userns-remap", root}...)
@@ -477,14 +477,14 @@ func (d *Daemon) queryRootDir() (string, error) {
477477
//}
478478

479479
func (d *Daemon) waitRun(contID string) error {
480-
args := []string{"--host", os.Getenv("DOCKER_HOST")}
480+
args := []string{"--region", os.Getenv("DOCKER_HOST")}
481481
return waitInspectWithArgs(contID, "{{.State.Running}}", "true", 10*time.Second, args...)
482482
}
483483

484484
// Cmd will execute a docker CLI command against this Daemon.
485485
// Example: d.Cmd("version") will run docker -H unix://path/to/unix.sock version
486486
func (d *Daemon) Cmd(name string, arg ...string) (string, error) {
487-
args := []string{"--host", os.Getenv("DOCKER_HOST"), name}
487+
args := []string{"--region", os.Getenv("DOCKER_HOST"), name}
488488
args = append(args, arg...)
489489
c := exec.Command(dockerBinary, args...)
490490
b, err := c.CombinedOutput()
@@ -669,7 +669,7 @@ func readBody(b io.ReadCloser) ([]byte, error) {
669669

670670
func deleteContainer(container string) error {
671671
container = strings.TrimSpace(strings.Replace(container, "\n", " ", -1))
672-
rmArgs := strings.Split(fmt.Sprintf("--host=%v rm -fv %v", os.Getenv("DOCKER_HOST"), container), " ")
672+
rmArgs := strings.Split(fmt.Sprintf("--region=%v rm -fv %v", os.Getenv("DOCKER_HOST"), container), " ")
673673
exitCode, err := runCommand(exec.Command(dockerBinary, rmArgs...))
674674
// set error manually if not set
675675
if exitCode != 0 && err == nil {
@@ -979,41 +979,41 @@ func pathExist(_path string) bool {
979979
}
980980

981981
func dockerCmdWithError(args ...string) (string, int, error) {
982-
arg := []string{"--host=" + os.Getenv("DOCKER_HOST")}
982+
arg := []string{"--region=" + os.Getenv("DOCKER_HOST")}
983983
args = append(arg, args...)
984984
return integration.DockerCmdWithError(dockerBinary, args...)
985985
}
986986

987987
func dockerCmdWithStdoutStderr(c *check.C, args ...string) (string, string, int) {
988-
arg := []string{"--host=" + os.Getenv("DOCKER_HOST")}
988+
arg := []string{"--region=" + os.Getenv("DOCKER_HOST")}
989989
args = append(arg, args...)
990990
return integration.DockerCmdWithStdoutStderr(dockerBinary, c, args...)
991991
}
992992

993993
func dockerCmd(c *check.C, args ...string) (string, int) {
994-
//append -H (--host)
995-
arg := []string{"--host=" + os.Getenv("DOCKER_HOST")}
994+
//append -H (--region)
995+
arg := []string{"--region=" + os.Getenv("DOCKER_HOST")}
996996
args = append(arg, args...)
997997
return integration.DockerCmd(dockerBinary, c, args...)
998998
}
999999

10001000
// execute a docker command with a timeout
10011001
func dockerCmdWithTimeout(timeout time.Duration, args ...string) (string, int, error) {
1002-
arg := []string{"--host=" + os.Getenv("DOCKER_HOST")}
1002+
arg := []string{"--region=" + os.Getenv("DOCKER_HOST")}
10031003
args = append(arg, args...)
10041004
return integration.DockerCmdWithTimeout(dockerBinary, timeout, args...)
10051005
}
10061006

10071007
// execute a docker command in a directory
10081008
func dockerCmdInDir(c *check.C, path string, args ...string) (string, int, error) {
1009-
arg := []string{"--host=" + os.Getenv("DOCKER_HOST")}
1009+
arg := []string{"--region=" + os.Getenv("DOCKER_HOST")}
10101010
args = append(arg, args...)
10111011
return integration.DockerCmdInDir(dockerBinary, path, args...)
10121012
}
10131013

10141014
// execute a docker command in a directory with a timeout
10151015
func dockerCmdInDirWithTimeout(timeout time.Duration, path string, args ...string) (string, int, error) {
1016-
arg := []string{"--host=" + os.Getenv("DOCKER_HOST")}
1016+
arg := []string{"--region=" + os.Getenv("DOCKER_HOST")}
10171017
args = append(arg, args...)
10181018
return integration.DockerCmdInDirWithTimeout(dockerBinary, timeout, path, args...)
10191019
}
@@ -1794,7 +1794,7 @@ func createTmpFile(c *check.C, content string) string {
17941794

17951795
func buildImageWithOutInDamon(socket string, name, dockerfile string, useCache bool) (string, error) {
17961796
fmt.Printf("[buildImageWithOutInDamon] socket: %v\n", socket)
1797-
args := []string{"--host", flag_host}
1797+
args := []string{"--region", flag_host}
17981798
buildCmd := buildImageCmdArgs(args, name, dockerfile, useCache)
17991799
out, exitCode, err := runCommandWithOutput(buildCmd)
18001800
if err != nil || exitCode != 0 {

integration-cli/hyper_cli_exec_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (s *DockerSuite) TestCliExecBasic(c *check.C) {
4040
testRequires(c, DaemonIsLinux)
4141
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "sh", "-c", "echo test > /tmp/file && top")
4242
43-
execCmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", "-i", "test", "sh")
43+
execCmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", "-i", "test", "sh")
4444
stdin, err := execCmd.StdinPipe()
4545
c.Assert(err, checker.IsNil)
4646
stdout, err := execCmd.StdoutPipe()
@@ -113,7 +113,7 @@ func (s *DockerSuite) TestCliExecExitStatus(c *check.C) {
113113
runSleepingContainer(c, "-d", "--name", "top")
114114

115115
// Test normal (non-detached) case first
116-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", "top", "sh", "-c", "exit 23")
116+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", "top", "sh", "-c", "exit 23")
117117
ec, _ := runCommand(cmd)
118118
c.Assert(ec, checker.Equals, 23)
119119
}
@@ -127,7 +127,7 @@ func (s *DockerSuite) TestCliExecExitStatus(c *check.C) {
127127
testRequires(c, DaemonIsLinux)
128128
dockerCmd(c, "run", "-d", "-it", "--name", "test", "busybox")
129129
130-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", "-i", "test", "cat")
130+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", "-i", "test", "cat")
131131
stdinRw, err := cmd.StdinPipe()
132132
c.Assert(err, checker.IsNil)
133133
@@ -158,7 +158,7 @@ func (s *DockerSuite) TestCliExecTTYWithoutStdin(c *check.C) {
158158
go func() {
159159
defer close(errChan)
160160

161-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", "-ti", id, "true")
161+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", "-ti", id, "true")
162162
if _, err := cmd.StdinPipe(); err != nil {
163163
errChan <- err
164164
return
@@ -192,7 +192,7 @@ func (s *DockerSuite) TestCliExecParseError(c *check.C) {
192192
dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
193193

194194
// Test normal (non-detached) case first
195-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", "top")
195+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", "top")
196196
_, stderr, _, err := runCommandWithStdoutStderr(cmd)
197197
c.Assert(err, checker.NotNil)
198198
c.Assert(stderr, checker.Contains, "See '"+dockerBinary+" exec --help'")
@@ -207,7 +207,7 @@ func (s *DockerSuite) TestCliExecStopNotHanging(c *check.C) {
207207
testRequires(c, DaemonIsLinux)
208208
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
209209

210-
err := exec.Command(dockerBinary, "exec", "--host="+os.Getenv("DOCKER_HOST"), "test", "top").Start()
210+
err := exec.Command(dockerBinary, "exec", "--region="+os.Getenv("DOCKER_HOST"), "test", "top").Start()
211211
c.Assert(err, checker.IsNil)
212212

213213
type dstop struct {
@@ -217,7 +217,7 @@ func (s *DockerSuite) TestCliExecStopNotHanging(c *check.C) {
217217

218218
ch := make(chan dstop)
219219
go func() {
220-
out, err := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "stop", "test").CombinedOutput()
220+
out, err := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "stop", "test").CombinedOutput()
221221
ch <- dstop{out, err}
222222
close(ch)
223223
}()
@@ -369,7 +369,7 @@ func (s *DockerSuite) TestCliExecRunMutableNetworkFiles(c *check.C) {
369369
for _, fn := range []string{"resolv.conf", "hosts"} {
370370
deleteAllContainers()
371371

372-
content, err := runCommandAndReadContainerFile(fn, exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "run", "-d", "--name", "c1", "busybox", "sh", "-c", fmt.Sprintf("echo success >/etc/%s && top", fn)))
372+
content, err := runCommandAndReadContainerFile(fn, exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "run", "-d", "--name", "c1", "busybox", "sh", "-c", fmt.Sprintf("echo success >/etc/%s && top", fn)))
373373
c.Assert(err, checker.IsNil)
374374

375375
c.Assert(strings.TrimSpace(string(content)), checker.Equals, "success", check.Commentf("Content was not what was modified in the container", string(content)))
@@ -430,7 +430,7 @@ func (s *DockerSuite) TestCliExecInspectID(c *check.C) {
430430
c.Assert(out, checker.Equals, "[]", check.Commentf("ExecIDs should be empty, got: %s", out))
431431

432432
// Start an exec, have it block waiting so we can do some checking
433-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", id, "sh", "-c",
433+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", id, "sh", "-c",
434434
"while ! test -e /execid1; do sleep 1; done")
435435

436436
err := cmd.Start()
@@ -454,7 +454,7 @@ func (s *DockerSuite) TestCliExecInspectID(c *check.C) {
454454
c.Assert(err, checker.IsNil, check.Commentf("failed to get the exec id"))
455455

456456
// End the exec by creating the missing file
457-
err = exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", id,
457+
err = exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", id,
458458
"sh", "-c", "touch /execid1").Run()
459459

460460
c.Assert(err, checker.IsNil, check.Commentf("failed to run the 2nd exec cmd"))

integration-cli/hyper_cli_exec_unix_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (s *DockerSuite) TestCliExecInteractiveStdinClose(c *check.C) {
2525
out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
2626
contID := strings.TrimSpace(out)
2727

28-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", "-i", contID, "echo", "-n", "hello")
28+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", "-i", contID, "echo", "-n", "hello")
2929
p, err := pty.Start(cmd)
3030
c.Assert(err, checker.IsNil)
3131

@@ -52,7 +52,7 @@ func (s *DockerSuite) TestCliExecTTY(c *check.C) {
5252
testRequires(c, DaemonIsLinux)
5353
dockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
5454

55-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "exec", "-it", "test", "sh")
55+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "exec", "-it", "test", "sh")
5656
p, err := pty.Start(cmd)
5757
c.Assert(err, checker.IsNil)
5858
defer p.Close()

integration-cli/hyper_cli_help_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (s *DockerSuite) TestCliHelpTextVerifyBasic(c *check.C) {
122122
for _, cmd := range cmdsToTest {
123123
var stderr string
124124

125-
args := strings.Split("--host="+os.Getenv("DOCKER_HOST")+" "+cmd+" --help", " ")
125+
args := strings.Split("--region="+os.Getenv("DOCKER_HOST")+" "+cmd+" --help", " ")
126126

127127
// Check the full usage text
128128
helpCmd := exec.Command(dockerBinary, args...)
@@ -206,14 +206,14 @@ func (s *DockerSuite) TestCliHelpTextVerifyBasic(c *check.C) {
206206

207207
ec := 0
208208
if _, ok := skipNoArgs[cmd]; !ok {
209-
args = strings.Split("--host="+os.Getenv("DOCKER_HOST")+" "+cmd, " ")
209+
args = strings.Split("--region="+os.Getenv("DOCKER_HOST")+" "+cmd, " ")
210210
dCmd = exec.Command(dockerBinary, args...)
211211
stdout, stderr, ec, err = runCommandWithStdoutStderr(dCmd)
212212
}
213213

214214
// If its ok w/o any args then try again with an arg
215215
if ec == 0 {
216-
args = strings.Split("--host="+os.Getenv("DOCKER_HOST")+" "+cmd+" badArg", " ")
216+
args = strings.Split("--region="+os.Getenv("DOCKER_HOST")+" "+cmd+" badArg", " ")
217217
dCmd = exec.Command(dockerBinary, args...)
218218
stdout, stderr, ec, err = runCommandWithStdoutStderr(dCmd)
219219
}

integration-cli/hyper_cli_links_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func (s *DockerSuite) TestCliLinksPingLinkedContainersBasic(c *check.C) {
4343
testRequires(c, DaemonIsLinux)
4444

4545
pullImageIfNotExist("busybox")
46-
dockerCmd(c, "run", "-d", "--name", "container1", "--hostname", "fred", "busybox", "top")
47-
dockerCmd(c, "run", "-d", "--name", "container2", "--hostname", "wilma", "busybox", "top")
46+
dockerCmd(c, "run", "-d", "--name", "container1", "--regionname", "fred", "busybox", "top")
47+
dockerCmd(c, "run", "-d", "--name", "container2", "--regionname", "wilma", "busybox", "top")
4848

4949
runArgs := []string{"run", "--rm", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "sh", "-c"}
5050
pingCmd := "ping -c 1 %s -W 5 && ping -c 1 %s -W 5"

integration-cli/hyper_cli_logs_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ func (s *DockerSuite) TestCliLogsSince(c *check.C) {
206206
// Test with default value specified and parameter omitted
207207
expected := []string{"log1", "log2", "log3"}
208208
for _, cmd := range []*exec.Cmd{
209-
exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "logs", "-t", name),
210-
exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "logs", "-t", "--since=0", name),
209+
exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "logs", "-t", name),
210+
exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "logs", "-t", "--since=0", name),
211211
} {
212212
out, _, err = runCommandWithOutput(cmd)
213213
c.Assert(err, checker.IsNil, check.Commentf("failed to log container: %s", out))
@@ -263,7 +263,7 @@ func (s *DockerSuite) TestCliLogsSinceFutureFollow(c *check.C) {
263263
264264
nroutines := getNGoroutines()
265265
266-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "logs", "-f", id)
266+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "logs", "-f", id)
267267
r, w := io.Pipe()
268268
cmd.Stdout = w
269269
c.Assert(cmd.Start(), checker.IsNil)
@@ -318,7 +318,7 @@ func (s *DockerSuite) TestCliLogsFollowGoroutinesNoOutput(c *check.C) {
318318
319319
nroutines := getNGoroutines()
320320
321-
cmd := exec.Command(dockerBinary, "--host="+os.Getenv("DOCKER_HOST"), "logs", "-f", id)
321+
cmd := exec.Command(dockerBinary, "--region="+os.Getenv("DOCKER_HOST"), "logs", "-f", id)
322322
c.Assert(cmd.Start(), checker.IsNil)
323323
time.Sleep(200 * time.Millisecond)
324324
c.Assert(cmd.Process.Kill(), checker.IsNil)

0 commit comments

Comments
 (0)