初版功能完成
ci / Go checks (ubuntu-latest) (push) Has been cancelled
ci / Go checks (windows-latest) (push) Has been cancelled

This commit is contained in:
qsc
2026-08-29 13:12:17 +08:00
commit 142e5dc7d6
217 changed files with 21313 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
//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")
}
}