summaryrefslogtreecommitdiff
path: root/go/internal/sshenv/sshenv_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/internal/sshenv/sshenv_test.go')
-rw-r--r--go/internal/sshenv/sshenv_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/go/internal/sshenv/sshenv_test.go b/go/internal/sshenv/sshenv_test.go
new file mode 100644
index 0000000..d2207f5
--- /dev/null
+++ b/go/internal/sshenv/sshenv_test.go
@@ -0,0 +1,20 @@
+package sshenv
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitlab-shell/go/internal/testhelper"
+)
+
+func TestLocalAddr(t *testing.T) {
+ cleanup, err := testhelper.Setenv("SSH_CONNECTION", "127.0.0.1 0")
+ require.NoError(t, err)
+ defer cleanup()
+
+ require.Equal(t, LocalAddr(), "127.0.0.1")
+}
+
+func TestEmptyLocalAddr(t *testing.T) {
+ require.Equal(t, LocalAddr(), "")
+}