Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d0e63b

Browse files
committed
Fix config ssh tests
1 parent3e31c06 commit5d0e63b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

‎cli/configssh_test.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"net"
77
"os"
88
"os/exec"
9-
"path/filepath"
109
"strings"
1110
"testing"
1211

@@ -27,6 +26,11 @@ import (
2726

2827
funcTestConfigSSH(t*testing.T) {
2928
t.Parallel()
29+
_,err:=exec.LookPath("socat")
30+
iferr!=nil {
31+
t.Skip("You must have socat installed to run this test!")
32+
}
33+
3034
client:=coderdtest.New(t,nil)
3135
user:=coderdtest.CreateFirstUser(t,client)
3236
coderdtest.NewProvisionerDaemon(t,client)
@@ -85,13 +89,15 @@ func TestConfigSSH(t *testing.T) {
8589
require.NoError(t,err)
8690
deferagentConn.Close()
8791

88-
// Using socat we can force SSH to use aUNIX socket
92+
// Using socat we can force SSH to use aTCP port
8993
// created in this test. That way we still validate
9094
// our configuration, but use the native SSH command
9195
// line to interface.
92-
socket:=filepath.Join(t.TempDir(),"ssh")
93-
listener,err:=net.Listen("unix",socket)
96+
listener,err:=net.Listen("tcp","127.0.0.1:0")
9497
require.NoError(t,err)
98+
t.Cleanup(func() {
99+
_=listener.Close()
100+
})
95101
gofunc() {
96102
for {
97103
conn,err:=listener.Accept()
@@ -108,7 +114,7 @@ func TestConfigSSH(t *testing.T) {
108114
_=listener.Close()
109115
})
110116

111-
cmd,root:=clitest.New(t,"config-ssh","--ssh-option","ProxyCommand socat -UNIX-CLIENT:"+socket,"--ssh-config-file",tempFile.Name())
117+
cmd,root:=clitest.New(t,"config-ssh","--ssh-option","ProxyCommand socat -TCP4:"+listener.Addr().String(),"--ssh-config-file",tempFile.Name())
112118
clitest.SetupConfig(t,client,root)
113119
doneChan:=make(chanstruct{})
114120
pty:=ptytest.New(t)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp