MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / TestDialIdentityAgentUnix

Function TestDialIdentityAgentUnix

pkg/remote/sshagent_unix_test.go:11–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestDialIdentityAgentUnix(t *testing.T) {
12 socketPath := filepath.Join(t.TempDir(), "agent.sock")
13
14 ln, err := net.Listen("unix", socketPath)
15 if err != nil {
16 t.Fatalf("listen unix socket: %v", err)
17 }
18 defer ln.Close()
19
20 acceptDone := make(chan struct{})
21 go func() {
22 conn, _ := ln.Accept()
23 if conn != nil {
24 conn.Close()
25 }
26 close(acceptDone)
27 }()
28
29 conn, err := dialIdentityAgent(socketPath)
30 if err != nil {
31 t.Fatalf("dialIdentityAgent: %v", err)
32 }
33 conn.Close()
34 <-acceptDone
35}

Callers

nothing calls this directly

Calls 2

dialIdentityAgentFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected