summaryrefslogtreecommitdiffhomepage
path: root/ssh/tailssh/tailssh_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/tailssh/tailssh_test.go')
-rw-r--r--ssh/tailssh/tailssh_test.go47
1 files changed, 24 insertions, 23 deletions
diff --git a/ssh/tailssh/tailssh_test.go b/ssh/tailssh/tailssh_test.go
index 7fed58c05..09d6ed6f6 100644
--- a/ssh/tailssh/tailssh_test.go
+++ b/ssh/tailssh/tailssh_test.go
@@ -211,34 +211,11 @@ func TestSSH(t *testing.T) {
dir := t.TempDir()
lb.SetVarRoot(dir)
- srv := &server{
- lb: lb,
- logf: logf,
- }
- ss, err := srv.newSSHServer()
- if err != nil {
- t.Fatal(err)
- }
-
u, err := user.Current()
if err != nil {
t.Fatal(err)
}
- ci := &sshConnInfo{
- sshUser: "test",
- src: netaddr.MustParseIPPort("1.2.3.4:32342"),
- dst: netaddr.MustParseIPPort("1.2.3.5:22"),
- node: &tailcfg.Node{},
- uprof: &tailcfg.UserProfile{},
- }
-
- ss.Handler = func(s ssh.Session) {
- ss := srv.newSSHSession(s, ci, u)
- ss.action = &tailcfg.SSHAction{Accept: true}
- ss.run()
- }
-
ln, err := net.Listen("tcp4", "127.0.0.1:0")
if err != nil {
t.Fatal(err)
@@ -255,6 +232,30 @@ func TestSSH(t *testing.T) {
}
return
}
+
+ srv := &server{
+ lb: lb,
+ logf: logf,
+ }
+ ss, err := srv.newSSHServer(c)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ ci := &sshConnInfo{
+ sshUser: "test",
+ src: netaddr.MustParseIPPort("1.2.3.4:32342"),
+ dst: netaddr.MustParseIPPort("1.2.3.5:22"),
+ node: &tailcfg.Node{},
+ uprof: &tailcfg.UserProfile{},
+ }
+
+ ss.Handler = func(s ssh.Session) {
+ ss := srv.newSSHSession(s, ci, u)
+ ss.action = &tailcfg.SSHAction{Accept: true}
+ ss.run()
+ }
go ss.HandleConn(c)
}
}()