Skip to content

Commit ef4043a

Browse files
committed
Git test should use "echo" and trim space locally
On macOS this test was failing for me since "echo" for /bin/sh doesn't support "-n". I think the easiest solution is to just do that behavior locally.
1 parent cc80f38 commit ef4043a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

get_git_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10+
"strings"
1011
"testing"
1112
)
1213

@@ -295,14 +296,16 @@ func TestGitGetter_submodule(t *testing.T) {
295296
}
296297

297298
func TestGitGetter_setupGitEnv_sshKey(t *testing.T) {
298-
cmd := exec.Command("/bin/sh", "-c", "echo -n $GIT_SSH_COMMAND")
299+
cmd := exec.Command("/bin/sh", "-c", "echo $GIT_SSH_COMMAND")
299300
setupGitEnv(cmd, "/tmp/foo.pem")
300301
out, err := cmd.Output()
301302
if err != nil {
302303
t.Fatal(err)
303304
}
304-
if string(out) != "ssh -i /tmp/foo.pem" {
305-
t.Fatalf("unexpected GIT_SSH_COMMAND: %q", string(out))
305+
306+
actual := strings.TrimSpace(string(out))
307+
if actual != "ssh -i /tmp/foo.pem" {
308+
t.Fatalf("unexpected GIT_SSH_COMMAND: %q", actual)
306309
}
307310
}
308311

0 commit comments

Comments
 (0)