Skip to content

Commit

Permalink
Merge branch 'openshift:main' into OSD-19729
Browse files Browse the repository at this point in the history
  • Loading branch information
amej authored Apr 12, 2024
2 parents e156807 + 6be5130 commit 182e731
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions pkg/utils/shell_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package utils

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe("ShellChecker", func() {
var (
shellChecker ShellCheckerInterface
)

BeforeEach(func() {
shellChecker = DefaultShellChecker{}
})

Context("When checking a valid shell", func() {
It("Should return true for a valid shell path", func() {
validShellPath := "/bin/bash"
Expect(shellChecker.IsValidShell(validShellPath)).To(BeTrue())
})

It("Should return true for another valid shell path", func() {
validShellPath := "/bin/zsh"
Expect(shellChecker.IsValidShell(validShellPath)).To(BeTrue())
})
})

Context("When checking an invalid shell", func() {
It("Should return false for an invalid shell path", func() {
invalidShellPath := "/invalid/shell/path"
Expect(shellChecker.IsValidShell(invalidShellPath)).To(BeFalse())
})

It("Should return false for another invalid shell path", func() {
invalidShellPath := "/another/invalid/shell/path"
Expect(shellChecker.IsValidShell(invalidShellPath)).To(BeFalse())
})
})

Context("When checking an empty shell path", func() {
It("Should return false", func() {
Expect(shellChecker.IsValidShell("")).To(BeFalse())
})
})

Context("When checking a non-existent shell path", func() {
It("Should return false", func() {
nonExistentShellPath := "/path/that/does/not/exist"
Expect(shellChecker.IsValidShell(nonExistentShellPath)).To(BeFalse())
})
})
})

0 comments on commit 182e731

Please sign in to comment.