mirror of
https://github.com/containers/podman.git
synced 2025-05-22 09:36:57 +08:00
Minor fix splitting env vars in podman-commit
`string.Split()` splits into slice of size greater than 2 which may result in loss of environment variables fixes #3132 Signed-off-by: Divyansh Kamboj <kambojdivyansh2000@gmail.com>
This commit is contained in:
@ -194,4 +194,24 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(r.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman commit container check env variables", func() {
|
||||
s := podmanTest.Podman([]string{"run", "--name", "test1", "-e", "TEST=1=1-01=9.01", "-it", "alpine", "true"})
|
||||
s.WaitWithDefaultTimeout()
|
||||
Expect(s.ExitCode()).To(Equal(0))
|
||||
|
||||
c := podmanTest.Podman([]string{"commit", "test1", "newimage"})
|
||||
c.WaitWithDefaultTimeout()
|
||||
Expect(c.ExitCode()).To(Equal(0))
|
||||
|
||||
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect.ExitCode()).To(Equal(0))
|
||||
image := inspect.InspectImageJSON()
|
||||
|
||||
envMap := make(map[string]bool)
|
||||
for _, v := range image[0].Config.Env {
|
||||
envMap[v] = true
|
||||
}
|
||||
Expect(envMap["TEST=1=1-01=9.01"]).To(BeTrue())
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user