mirror of
https://github.com/fosrl/newt.git
synced 2026-02-08 05:56:40 +00:00
Remove bad test
This commit is contained in:
@@ -553,53 +553,3 @@ func TestSocketRouting(t *testing.T) {
|
|||||||
t.Errorf("Expected response from physical port %d, got %d", physicalAddr.Port, fromAddr.Port)
|
t.Errorf("Expected response from physical port %d, got %d", physicalAddr.Port, fromAddr.Port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestClearNetstackConn tests that clearing the netstack connection works correctly
|
|
||||||
func TestClearNetstackConn(t *testing.T) {
|
|
||||||
physicalConn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: 0})
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to create physical UDP connection: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
sharedBind, err := New(physicalConn)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to create SharedBind: %v", err)
|
|
||||||
}
|
|
||||||
defer sharedBind.Close()
|
|
||||||
|
|
||||||
// Set a netstack connection
|
|
||||||
netstackConn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: 0})
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to create netstack UDP connection: %v", err)
|
|
||||||
}
|
|
||||||
defer netstackConn.Close()
|
|
||||||
|
|
||||||
sharedBind.SetNetstackConn(netstackConn)
|
|
||||||
|
|
||||||
// Inject a packet to track an endpoint
|
|
||||||
testAddrPort := netip.MustParseAddrPort("192.168.1.100:51820")
|
|
||||||
err = sharedBind.InjectPacket([]byte("test"), testAddrPort)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("InjectPacket failed: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify the endpoint is tracked
|
|
||||||
_, tracked := sharedBind.netstackEndpoints.Load(testAddrPort.String())
|
|
||||||
if !tracked {
|
|
||||||
t.Error("Expected endpoint to be tracked as netstack-sourced")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the netstack connection
|
|
||||||
sharedBind.ClearNetstackConn()
|
|
||||||
|
|
||||||
// Verify the netstack connection is cleared
|
|
||||||
if sharedBind.GetNetstackConn() != nil {
|
|
||||||
t.Error("Expected netstack connection to be nil after clear")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify the tracked endpoints are cleared
|
|
||||||
_, stillTracked := sharedBind.netstackEndpoints.Load(testAddrPort.String())
|
|
||||||
if stillTracked {
|
|
||||||
t.Error("Expected endpoint tracking to be cleared")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user