diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-08-10 15:19:02 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-08-11 11:12:44 +0200 |
commit | c72bb4f8feb05a63c189fe6ce264ca652b399022 (patch) | |
tree | 1dd54206f46cba6e72cca5470a6b5da789007c3d /test | |
parent | 9a9ad853cb6781460829cb139cecbf9aff37896d (diff) | |
download | podman-c72bb4f8feb05a63c189fe6ce264ca652b399022.tar.gz podman-c72bb4f8feb05a63c189fe6ce264ca652b399022.tar.bz2 podman-c72bb4f8feb05a63c189fe6ce264ca652b399022.zip |
generate systemd: fix error handling
Fix a bug in the error handling which returned nil instead of an error
and ultimately lead to nil dereferences in the client. To prevent
future regressions, add a test and check for the error message.
Fixes: #7271
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/generate_systemd_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go index 654e99531..151d3f6fc 100644 --- a/test/e2e/generate_systemd_test.go +++ b/test/e2e/generate_systemd_test.go @@ -53,6 +53,18 @@ var _ = Describe("Podman generate systemd", func() { Expect(session).To(ExitWithError()) }) + It("podman generate systemd bad restart-policy value", func() { + session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"generate", "systemd", "--restart-policy", "bogus", "foobar"}) + session.WaitWithDefaultTimeout() + Expect(session).To(ExitWithError()) + found, _ := session.ErrorGrepString("Error: bogus is not a valid restart policy") + Expect(found).Should(BeTrue()) + }) + It("podman generate systemd good timeout value", func() { session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"}) session.WaitWithDefaultTimeout() |