Skip to content

Commit

Permalink
Merge pull request #15839 from cdoern/clone
Browse files Browse the repository at this point in the history
podman container clone env patch
  • Loading branch information
openshift-merge-robot authored Sep 17, 2022
2 parents 8f76bc2 + 049b108 commit 4e14fa0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/specgen/generate/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s
if conf.Spec.Process != nil && conf.Spec.Process.Env != nil {
env := make(map[string]string)
for _, entry := range conf.Spec.Process.Env {
split := strings.Split(entry, "=")
split := strings.SplitN(entry, "=", 2)
if len(split) == 2 {
env[split[0]] = split[1]
}
Expand Down
13 changes: 13 additions & 0 deletions test/e2e/container_clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,5 +308,18 @@ var _ = Describe("Podman container clone", func() {
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("123"))

session = podmanTest.Podman([]string{"run", "--name", "env_ctr2", "-e", "ENV_TEST=12=3", ALPINE, "printenv", "ENV_TEST"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))

session = podmanTest.Podman([]string{"container", "clone", "env_ctr2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))

session = podmanTest.Podman([]string{"start", "-a", "env_ctr2-clone"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("12=3"))

})
})

0 comments on commit 4e14fa0

Please sign in to comment.