Files
RemLink/internal/nodeagent/run_windows_test.go
T
qsc20001102 142e5dc7d6
ci / Go checks (ubuntu-latest) (push) Has been cancelled
ci / Go checks (windows-latest) (push) Has been cancelled
初版功能完成
2026-08-29 13:12:17 +08:00

37 lines
734 B
Go

//go:build windows
package nodeagent
import (
"context"
"net"
"testing"
"time"
)
func TestWaitForOverlayControlConnectsTCP(t *testing.T) {
listener, err := net.Listen("tcp4", "127.0.0.1:0")
if err != nil {
t.Fatal(err)
}
defer listener.Close()
accepted := make(chan struct{})
go func() {
connection, err := listener.Accept()
if err == nil {
_ = connection.Close()
close(accepted)
}
}()
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
if err := waitForOverlayControl(ctx, "ws://"+listener.Addr().String()+"/control"); err != nil {
t.Fatal(err)
}
select {
case <-accepted:
case <-time.After(time.Second):
t.Fatal("Overlay Control probe was not accepted")
}
}