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

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

Merged
merged 1 commit into from
Feb 16, 2015
Merged

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

merged 1 commit into from
Feb 16, 2015

Conversation

ahmetb
Copy link
Contributor

@ahmetb 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")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just do:

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ahmetb ahmetb changed the title docker_cli_run_test: Preserve DOCKER_TEST_HOST in env-clearing tests integration-cli: Preserve DOCKER_TEST_HOST in env-clearing tests 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>
@tianon
Copy link
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
Copy link
Contributor

LGTM!

icecrime pushed a commit that referenced this pull request Feb 16, 2015
integration-cli: Preserve DOCKER_TEST_HOST in env-clearing tests
@icecrime icecrime merged commit 9ee8d41 into moby:master Feb 16, 2015
@ahmetb ahmetb deleted the TestRunEnv-fix branch February 16, 2015 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants