summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-25 06:46:17 -0400
committerGitHub <noreply@github.com>2020-05-25 06:46:17 -0400
commit1077d2d0b72d027a01080c0d3ebdb7d99a969661 (patch)
treefd6b32e485b0985cff943a2084258fd991a9ec35 /test/e2e
parent3fec749f56627fa955f8529392be2c1edcdab452 (diff)
parente704f1362abc416786076a932d8e2ca930b9fa2e (diff)
downloadpodman-1077d2d0b72d027a01080c0d3ebdb7d99a969661.tar.gz
podman-1077d2d0b72d027a01080c0d3ebdb7d99a969661.tar.bz2
podman-1077d2d0b72d027a01080c0d3ebdb7d99a969661.zip
Merge pull request #6321 from Luap99/podman-generate-systemd-unit-prefix
Allow to change the generated systemd unit name prefix
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/generate_systemd_test.go92
1 files changed, 92 insertions, 0 deletions
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index abfca4db9..d5ae441e2 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -233,4 +233,96 @@ var _ = Describe("Podman generate systemd", func() {
Expect(session.ExitCode()).To(Equal(125))
})
+ It("podman generate systemd --container-prefix con", func() {
+ n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--name", "--container-prefix", "con", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // Grepping the output (in addition to unit tests)
+ found, _ := session.GrepString("# con-foo.service")
+ Expect(found).To(BeTrue())
+ })
+
+ It("podman generate systemd --separator _", func() {
+ n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--name", "--separator", "_", "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())
+ })
+
+ It("podman generate systemd pod --pod-prefix p", func() {
+ n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-2", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--pod-prefix", "p", "--name", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // Grepping the output (in addition to unit tests)
+ found, _ := session.GrepString("# p-foo.service")
+ Expect(found).To(BeTrue())
+
+ found, _ = session.GrepString("Requires=container-foo-1.service container-foo-2.service")
+ Expect(found).To(BeTrue())
+
+ found, _ = session.GrepString("# container-foo-1.service")
+ Expect(found).To(BeTrue())
+
+ found, _ = session.GrepString("BindsTo=p-foo.service")
+ Expect(found).To(BeTrue())
+ })
+
+ It("podman generate systemd pod --pod-prefix p --container-prefix con --separator _ change all prefixes/separator", func() {
+ n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-2", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--container-prefix", "con", "--pod-prefix", "p", "--separator", "_", "--name", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // Grepping the output (in addition to unit tests)
+ found, _ := session.GrepString("# p_foo.service")
+ Expect(found).To(BeTrue())
+
+ found, _ = session.GrepString("Requires=con_foo-1.service con_foo-2.service")
+ Expect(found).To(BeTrue())
+
+ found, _ = session.GrepString("# con_foo-1.service")
+ Expect(found).To(BeTrue())
+
+ found, _ = session.GrepString("# con_foo-2.service")
+ Expect(found).To(BeTrue())
+
+ found, _ = session.GrepString("BindsTo=p_foo.service")
+ Expect(found).To(BeTrue())
+ })
})