Skip to content

Commit

Permalink
Auto-skip if git isn't available
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Jan 19, 2024
1 parent 30a4a7e commit 79a1e6a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func TestGenerate(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
if !binaryAvailable("git") {
t.Skip("skipping test because git is not available")
}

_ = klogtest.InitKlog(t)
klog.SetLogger(ktesting.NewLogger(t, ktesting.NewConfig()))
Expand Down Expand Up @@ -67,6 +70,11 @@ func TestGenerate(t *testing.T) {
}
}

func binaryAvailable(bin string) bool {
p, err := exec.LookPath(bin)
return err == nil && len(p) > 0
}

func prepareWorkdir(tb testing.TB) (string, string) {
var sourcedir string
if s, err := current.Dir(); err != nil {
Expand Down

0 comments on commit 79a1e6a

Please sign in to comment.