From 3cfb90fb5b24ef894da3c6eeaf88c955b99b024b Mon Sep 17 00:00:00 2001 From: William Banfield Date: Wed, 30 Nov 2022 18:05:10 -0500 Subject: [PATCH] error if auth sock not defined --- test/e2e/pkg/ssh/ssh.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/e2e/pkg/ssh/ssh.go b/test/e2e/pkg/ssh/ssh.go index 07be10ccc..08a5324e6 100644 --- a/test/e2e/pkg/ssh/ssh.go +++ b/test/e2e/pkg/ssh/ssh.go @@ -1,6 +1,7 @@ package ssh import ( + "errors" "net" "os" "path/filepath" @@ -25,7 +26,11 @@ func Exec(cfg *ssh.ClientConfig, addr, cmd string) error { } func NewClientConfig() (*ssh.ClientConfig, error) { - c, err := net.Dial("unix", os.Getenv("SSH_AUTH_SOCK")) + ss := os.Getenv("SSH_AUTH_SOCK") + if ss == "" { + return nil, errors.New("SSH_AUTH_SOCK environment variable is empty. Is the ssh-agent running?") + } + c, err := net.Dial("unix", ss) if err != nil { return nil, err }