From dadffe3e4feeb64ab5ae7ace4c171f64f18345eb Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Fri, 28 Apr 2023 16:21:28 -0400 Subject: [PATCH] test rm{,i,p} subcommands help message Signed-off-by: Etienne Champetier --- test/e2e/help_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test/e2e/help_test.go b/test/e2e/help_test.go index e31af5cf15..2a94f2b3ea 100644 --- a/test/e2e/help_test.go +++ b/test/e2e/help_test.go @@ -18,6 +18,7 @@ package e2e import ( . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega/gexec" ) // The actual test suite @@ -42,3 +43,43 @@ var _ = t.Describe("help", func() { "flag provided but not defined") }) }) + +// The actual test suite +var _ = t.Describe("help subcommand", func() { + + var ( + endpoint, testDir string + crio *Session + ) + BeforeEach(func() { + endpoint, testDir, crio = t.StartCrio() + }) + + AfterEach(func() { + t.StopCrio(testDir, crio) + }) + + It("should show help running rm without params", func() { + t.CrictlExpectSuccessWithEndpoint(endpoint, "rm", "crictl rm command") + }) + + It("should show help running rmi without params", func() { + t.CrictlExpectSuccessWithEndpoint(endpoint, "rmi", "crictl rmi command") + }) + + It("should show help running rmp without params", func() { + t.CrictlExpectSuccessWithEndpoint(endpoint, "rmp", "crictl rmp command") + }) + + It("should not show help running rm -a", func() { + t.CrictlExpect(endpoint, "rm -a", 0, "", "No containers to remove") + }) + + It("should not show help running rmi -a", func() { + t.CrictlExpect(endpoint, "rmi -a", 0, "", "No images to remove") + }) + + It("should not show help running rmp -a", func() { + t.CrictlExpect(endpoint, "rmp -a", 0, "", "No pods to remove") + }) +})