Skip to content

Commit

Permalink
Integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Feb 2, 2023
1 parent e454412 commit 63c7321
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/integration/cmd_logs_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
"os"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 63c7321

Please # to comment.