mirror of
https://github.com/containers/podman.git
synced 2025-06-24 19:42:56 +08:00
Merge pull request #7571 from vrothberg/fix-7157
generate systemd: catch `--name=foo`
This commit is contained in:
@ -220,6 +220,9 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
|
||||
case "--replace":
|
||||
hasReplaceParam = true
|
||||
}
|
||||
if strings.HasPrefix(p, "--name=") {
|
||||
hasNameParam = true
|
||||
}
|
||||
}
|
||||
|
||||
if !hasDetachParam {
|
||||
|
@ -189,7 +189,7 @@ var _ = Describe("Podman generate systemd", func() {
|
||||
Expect(found).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman generate systemd --new", func() {
|
||||
It("podman generate systemd --new --name foo", func() {
|
||||
n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
|
||||
n.WaitWithDefaultTimeout()
|
||||
Expect(n.ExitCode()).To(Equal(0))
|
||||
@ -202,6 +202,29 @@ var _ = Describe("Podman generate systemd", func() {
|
||||
found, _ := session.GrepString("# container-foo.service")
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
found, _ = session.GrepString(" --replace ")
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
found, _ = session.GrepString("stop --ignore --cidfile %t/container-foo.ctr-id -t 42")
|
||||
Expect(found).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman generate systemd --new --name=foo", func() {
|
||||
n := podmanTest.Podman([]string{"create", "--name=foo", "alpine", "top"})
|
||||
n.WaitWithDefaultTimeout()
|
||||
Expect(n.ExitCode()).To(Equal(0))
|
||||
|
||||
session := podmanTest.Podman([]string{"generate", "systemd", "-t", "42", "--name", "--new", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
// Grepping the output (in addition to unit tests)
|
||||
found, _ := session.GrepString("# container-foo.service")
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
found, _ = session.GrepString(" --replace ")
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
found, _ = session.GrepString("stop --ignore --cidfile %t/container-foo.ctr-id -t 42")
|
||||
Expect(found).To(BeTrue())
|
||||
})
|
||||
|
Reference in New Issue
Block a user