Revert error handling behaviour in test to support auto net.Conn creation

This commit is contained in:
Zoltan Papp
2025-07-16 21:16:07 +02:00
parent 04619fe54f
commit fcb06d1a23
2 changed files with 6 additions and 6 deletions

View File

@@ -314,8 +314,8 @@ func TestBindToUnavailabePeer(t *testing.T) {
t.Errorf("failed to connect to server: %s", err)
}
_, err = clientAlice.OpenConn(ctx, "bob")
if err == nil {
t.Errorf("expected error when binding to unavailable peer, got nil")
if err != nil {
t.Errorf("failed to open bob: %s", err)
}
log.Infof("closing client")

View File

@@ -285,15 +285,15 @@ func TestForeginAutoClose(t *testing.T) {
}
t.Log("open connection to another peer")
if _, err = mgr.OpenConn(ctx, toURL(srvCfg2)[0], "anotherpeer"); err == nil {
t.Fatalf("should have failed to open connection to another peer")
if _, err = mgr.OpenConn(ctx, toURL(srvCfg2)[0], "anotherpeer"); err != nil {
t.Fatalf("failed to open connection: %s", err)
}
timeout := relayCleanupInterval + keepUnusedServerTime + 1*time.Second
t.Logf("waiting for relay cleanup: %s", timeout)
time.Sleep(timeout)
if len(mgr.relayClients) != 0 {
t.Errorf("expected 0, got %d", len(mgr.relayClients))
if len(mgr.relayClients) != 1 {
t.Errorf("expected 1 relay client, got %d", len(mgr.relayClients))
}
t.Logf("closing manager")