Add an ns1 test-and-deploy workflow for the Go MCP server.
scripts/deploy-138.sh tests with Go 1.26.9, swaps the live binary, and rolls back if port 8000 stops answering. Port 0 in the embedded NATS listener now picks an ephemeral port so the test can run while 4222 is already taken.
This commit is contained in:
parent
deb0e251de
commit
dc39095694
1 changed files with 162 additions and 1 deletions
|
|
@ -119,5 +119,15 @@ func splitHostPort(listen string) (string, int, error) {
|
|||
if host == "" {
|
||||
host = "127.0.0.1"
|
||||
}
|
||||
// nats-server treats port 0 as its default (4222), which is already taken
|
||||
// on ns1. Bind an ephemeral port and hand that number to the server.
|
||||
if port == 0 {
|
||||
ln, err := net.Listen("tcp", net.JoinHostPort(host, "0"))
|
||||
if err != nil {
|
||||
return "", 0, fmt.Errorf("embednats: ephemeral listen: %w", err)
|
||||
}
|
||||
port = ln.Addr().(*net.TCPAddr).Port
|
||||
ln.Close()
|
||||
}
|
||||
return host, port, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue