From 63c732132559b6caf6966485ecd6417ec45745d3 Mon Sep 17 00:00:00 2001 From: Philippe Martin Date: Thu, 2 Feb 2023 16:28:43 +0100 Subject: [PATCH] Integration tests --- tests/integration/cmd_logs_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/integration/cmd_logs_test.go b/tests/integration/cmd_logs_test.go index 64a4ad9fe21..79db6bc6c24 100644 --- a/tests/integration/cmd_logs_test.go +++ b/tests/integration/cmd_logs_test.go @@ -1,6 +1,7 @@ package integration import ( + "os" "path/filepath" "strings" "time" @@ -54,6 +55,31 @@ var _ = Describe("odo logs command tests", func() { helper.CommonAfterEach(commonVar) }) + When("in a devfile directory", func() { + BeforeEach(func() { + helper.CopyExample(filepath.Join("source", "nodejs"), commonVar.Context) + helper.Cmd("odo", "init", "--name", componentName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile.yaml")).ShouldPass() + }) + When("not connected to any cluster or podman", Label(helper.LabelNoCluster), func() { + It("odo logs should fail with an error message", func() { + cmd := helper.Cmd("odo", "logs") + stderr := cmd.ShouldFail().Err() + Expect(stderr).To(ContainSubstring("you need access to a cluster")) + }) + + It("odo logs --platform podman should fail with an error message", func() { + os.Setenv("PODMAN_CMD", "false") + defer os.Unsetenv("PODMAN_CMD") + cmd := getLogCommand(true) + stderr := cmd.ShouldFail().Err() + Expect(stderr).To(ContainSubstring("you need access to podman")) + }) + }) + + When("podman is not installed", func() { + }) + }) + for _, podman := range []bool{false, true} { podman := podman When("directory is empty", helper.LabelPodmanIf(podman, func() {