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

integration-cli: Preserve DOCKER_TEST_HOST in env-clearing tests #10800

Merged
merged 1 commit into from Feb 16, 2015

Conversation

Projects
None yet
4 participants
@ahmetb
Contributor

ahmetb commented Feb 14, 2015

For Windows, we run integration-cli with DOCKER_TEST_HOST env var b/c
daemon is on some remote machine. This keeps the DOCKER_HOST set by
bash scripts in the env.

Signed-off-by: Ahmet Alp Balkan ahmetalpbalkan@gmail.com
Label: #windows
Cc: @tianon @unclejack @duglin @jfrazelle @icecrime

@@ -863,6 +863,10 @@ func TestRunEnvironmentErase(t *testing.T) {
// the container
cmd := exec.Command(dockerBinary, "run", "-e", "FOO", "-e", "HOSTNAME", "busybox", "env")
cmd.Env = []string{}
if os.Getenv("DOCKER_HOST") != "" { // retain DOCKER_TEST_HOST
cmd.Env = append(cmd.Env, fmt.Sprintf("DOCKER_HOST=%s", os.Getenv("DOCKER_HOST")))

This comment has been minimized.

@tianon

tianon Feb 14, 2015

Member

Why not just do:

cmd.Env = []string{
    fmt.Sprintf("DOCKER_HOST=%s", daemonHost()),
}

This comment has been minimized.

@ahmetb

ahmetb Feb 14, 2015

Contributor

it will include an extra unix://var/run/docker.sock even though it's not needed by default. I'm not sure if that's the desired behavior.

@@ -901,6 +905,10 @@ func TestRunEnvironmentOverride(t *testing.T) {
// already in the env that we're overriding them
cmd := exec.Command(dockerBinary, "run", "-e", "HOSTNAME", "-e", "HOME=/root2", "busybox", "env")
cmd.Env = []string{"HOSTNAME=bar"}
if os.Getenv("DOCKER_HOST") != "" { // retain DOCKER_TEST_HOST
cmd.Env = append(cmd.Env, fmt.Sprintf("DOCKER_HOST=%s", os.Getenv("DOCKER_HOST")))

This comment has been minimized.

@tianon

tianon Feb 14, 2015

Member

Why not just do:

cmd.Env = []string{
    "HOSTNAME=bar",
    fmt.Sprintf("DOCKER_HOST=%s", daemonHost()),
}

@ahmetb ahmetb changed the title from docker_cli_run_test: Preserve DOCKER_TEST_HOST in env-clearing tests to integration-cli: Preserve DOCKER_TEST_HOST in env-clearing tests Feb 14, 2015

docker_cli_run_test: Preserve DOCKER_TEST_HOST in env-clearing tests
For Windows, we run integration-cli with DOCKER_TEST_HOST env var b/c
daemon is on some remote machine. This keeps the DOCKER_HOST set by
bash scripts in the env.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
@tianon

This comment has been minimized.

Member

tianon commented Feb 14, 2015

+1 LGTM

This approach will let us add TLS support to our test suite more easily later, too.

@icecrime

This comment has been minimized.

Contributor

icecrime commented Feb 16, 2015

LGTM!

icecrime pushed a commit that referenced this pull request Feb 16, 2015

Arnaud Porterie
Merge pull request #10800 from ahmetalpbalkan/TestRunEnv-fix
integration-cli: Preserve DOCKER_TEST_HOST in env-clearing tests

@icecrime icecrime merged commit 9ee8d41 into moby:master Feb 16, 2015

1 of 2 checks passed

windows Jenkins build Windows-PRs 43 has failed
Details
janky Jenkins build Docker-PRs 1094 has succeeded
Details

@ahmetb ahmetb deleted the ahmetb:TestRunEnv-fix branch Feb 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment