mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2026-12-02 09:13:21 +00:00
- let deploy mode bind the listener before printing the Web UI address and report the actual bound endpoint when :0 is used - switch Unix and Windows regression deploy checks to parse the real base URL from deploy logs instead of preallocating a port in the script - add Unix deploy cleanup traps and make runner scripts temporary/self-cleaning - gate ICMP source-device propagation to Linux and macOS so unsupported Unix targets keep --dev as source-address selection only - add server and trace regression tests for the new listener and source-device behavior
23 lines
465 B
Go
23 lines
465 B
Go
package server
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
)
|
|
|
|
func TestListenHTTPReturnsActualBoundAddr(t *testing.T) {
|
|
listener, err := listenHTTP("127.0.0.1:0")
|
|
if err != nil {
|
|
t.Fatalf("listenHTTP() error = %v", err)
|
|
}
|
|
t.Cleanup(func() { _ = listener.Close() })
|
|
|
|
addr, ok := listener.Addr().(*net.TCPAddr)
|
|
if !ok {
|
|
t.Fatalf("listener addr = %T, want *net.TCPAddr", listener.Addr())
|
|
}
|
|
if addr.Port == 0 {
|
|
t.Fatal("listener port = 0, want non-zero bound port")
|
|
}
|
|
}
|