summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2021-01-05 11:48:37 -0500
committerMatthew Heon <mheon@redhat.com>2021-01-06 09:46:21 -0500
commit8f844a66d5d144eeb92870c27171dc8b35788d4f (patch)
tree5c6f85c34ad04d05eab23d0730298f92964739a7 /test
parent1b9366d650200d0f2029d628fa00d1fd318631aa (diff)
downloadpodman-8f844a66d5d144eeb92870c27171dc8b35788d4f.tar.gz
podman-8f844a66d5d144eeb92870c27171dc8b35788d4f.tar.bz2
podman-8f844a66d5d144eeb92870c27171dc8b35788d4f.zip
Ensure that user-specified HOSTNAME is honored
When adding the HOSTNAME environment variable, only do so if it is not already present in the spec. If it is already present, it was likely added by the user, and we should honor their requested value. Fixes #8886 Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 4888a676b..92d7d222e 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -1415,4 +1415,12 @@ WORKDIR /madethis`
Expect(session.ExitCode()).To(Equal(0))
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
})
+
+ It("podman run container with hostname and hostname environment variable", func() {
+ hostnameEnv := "test123"
+ session := podmanTest.Podman([]string{"run", "--hostname", "testctr", "--env", fmt.Sprintf("HOSTNAME=%s", hostnameEnv), ALPINE, "printenv", "HOSTNAME"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(hostnameEnv))
+ })
})