diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-11-07 10:03:46 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-20 16:25:31 +0000 |
commit | 57599f0075ccab859d4158f7ee891b9b971c731f (patch) | |
tree | 84bb48fc3ef1321a29816710cbb1221cc598b745 /cmd/kpod/create_cli_test.go | |
parent | 3b72af614777b966671ad0eb0c5dbde0eeedcfa2 (diff) | |
download | podman-57599f0075ccab859d4158f7ee891b9b971c731f.tar.gz podman-57599f0075ccab859d4158f7ee891b9b971c731f.tar.bz2 podman-57599f0075ccab859d4158f7ee891b9b971c731f.zip |
Fix up handling of environment variables
The way docker works is if a user specifies a non `-e Name=Value`, IE
just a `-e Name`, then the environment variable Name from the clients
OS.ENV is used.
Also by default Docker containers run with the HOSTNAME environment set
to the HOSTNAME specified for the container.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #21
Approved by: baude
Diffstat (limited to 'cmd/kpod/create_cli_test.go')
-rw-r--r-- | cmd/kpod/create_cli_test.go | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/cmd/kpod/create_cli_test.go b/cmd/kpod/create_cli_test.go index af5c5afae..63a1e5dd3 100644 --- a/cmd/kpod/create_cli_test.go +++ b/cmd/kpod/create_cli_test.go @@ -68,32 +68,3 @@ func TestGetAllLabelsFile(t *testing.T) { result, _ := getAllLabels(fileLabels, Var1) assert.Equal(t, len(result), 3) } - -func TestGetAllEnvironmentVariables(t *testing.T) { - fileEnvs := []string{} - result, _ := getAllEnvironmentVariables(fileEnvs, Var1) - assert.Equal(t, len(result), 2) -} - -func TestGetAllEnvironmentVariablesBadKeyValue(t *testing.T) { - inEnvs := []string{"ONE1", "TWO=2"} - fileEnvs := []string{} - _, err := getAllEnvironmentVariables(fileEnvs, inEnvs) - assert.Error(t, err, assert.AnError) -} - -func TestGetAllEnvironmentVariablesBadEnvFile(t *testing.T) { - fileEnvs := []string{"/foobar5001/be"} - _, err := getAllEnvironmentVariables(fileEnvs, Var1) - assert.Error(t, err, assert.AnError) -} - -func TestGetAllEnvironmentVariablesFile(t *testing.T) { - content := []byte("THREE=3") - tFile, err := createTmpFile(content) - defer os.Remove(tFile) - assert.NoError(t, err) - fileEnvs := []string{tFile} - result, _ := getAllEnvironmentVariables(fileEnvs, Var1) - assert.Equal(t, len(result), 3) -} |