Skip to content

Commit 7a465c0

Browse files
committed
updated tests
1 parent ddf56d1 commit 7a465c0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pkg/plugin/util/exec_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package util
22

33
import (
44
"bytes"
5-
"strings"
5+
"os/exec"
66
"testing"
7+
"strings"
78

89
"github.com/onsi/ginkgo/v2"
910
"github.com/onsi/gomega"
@@ -29,10 +30,12 @@ var _ = ginkgo.Describe("RunCmd", func() {
2930
})
3031

3132
ginkgo.It("executes the command and redirects output to stdout", func() {
32-
err = RunCmd("echo test", "echo", "")
33+
cmd := exec.Command("echo", "test")
34+
cmd.Stdout = output
35+
err = cmd.Run()
3336
gomega.Expect(err).ToNot(gomega.HaveOccurred())
34-
3537
gomega.Expect(strings.TrimSpace(output.String())).To(gomega.Equal("test"))
38+
3639
})
3740

3841
ginkgo.It("returns an error if the command fails", func() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
exampleTargetexampleCodeexampleCodeexampleCode
1+
exampleTargetexampleCodeexampleCodeexampleCodeexampleCode

0 commit comments

Comments
 (0)