mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-21 10:18:50 +02:00
Fix manager_test
This commit is contained in:
parent
a9e6742d9a
commit
d9dfae625b
@ -53,12 +53,12 @@ func TestForeignConn(t *testing.T) {
|
|||||||
log.Debugf("connect by alice")
|
log.Debugf("connect by alice")
|
||||||
mCtx, cancel := context.WithCancel(ctx)
|
mCtx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
clientAlice := NewManager(mCtx, srvCfg1.Address, idAlice)
|
clientAlice := NewManager(mCtx, toURL(srvCfg1), idAlice)
|
||||||
clientAlice.Serve()
|
clientAlice.Serve()
|
||||||
|
|
||||||
idBob := "bob"
|
idBob := "bob"
|
||||||
log.Debugf("connect by bob")
|
log.Debugf("connect by bob")
|
||||||
clientBob := NewManager(mCtx, srvCfg2.Address, idBob)
|
clientBob := NewManager(mCtx, toURL(srvCfg2), idBob)
|
||||||
clientBob.Serve()
|
clientBob.Serve()
|
||||||
|
|
||||||
bobsSrvAddr, err := clientBob.RelayInstanceAddress()
|
bobsSrvAddr, err := clientBob.RelayInstanceAddress()
|
||||||
@ -144,10 +144,10 @@ func TestForeginConnClose(t *testing.T) {
|
|||||||
log.Debugf("connect by alice")
|
log.Debugf("connect by alice")
|
||||||
mCtx, cancel := context.WithCancel(ctx)
|
mCtx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
mgr := NewManager(mCtx, srvCfg1.Address, idAlice)
|
mgr := NewManager(mCtx, toURL(srvCfg1), idAlice)
|
||||||
mgr.Serve()
|
mgr.Serve()
|
||||||
|
|
||||||
conn, err := mgr.OpenConn(srvCfg2.Address, "anotherpeer", nil)
|
conn, err := mgr.OpenConn(toURL(srvCfg2), "anotherpeer", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to bind channel: %s", err)
|
t.Fatalf("failed to bind channel: %s", err)
|
||||||
}
|
}
|
||||||
@ -206,11 +206,11 @@ func TestForeginAutoClose(t *testing.T) {
|
|||||||
t.Log("connect to server 1.")
|
t.Log("connect to server 1.")
|
||||||
mCtx, cancel := context.WithCancel(ctx)
|
mCtx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
mgr := NewManager(mCtx, srvCfg1.Address, idAlice)
|
mgr := NewManager(mCtx, toURL(srvCfg1), idAlice)
|
||||||
mgr.Serve()
|
mgr.Serve()
|
||||||
|
|
||||||
t.Log("open connection to another peer")
|
t.Log("open connection to another peer")
|
||||||
conn, err := mgr.OpenConn(srvCfg2.Address, "anotherpeer", nil)
|
conn, err := mgr.OpenConn(toURL(srvCfg2), "anotherpeer", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to bind channel: %s", err)
|
t.Fatalf("failed to bind channel: %s", err)
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ func TestAutoReconnect(t *testing.T) {
|
|||||||
|
|
||||||
mCtx, cancel := context.WithCancel(ctx)
|
mCtx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
clientAlice := NewManager(mCtx, srvCfg.Address, "alice")
|
clientAlice := NewManager(mCtx, toURL(srvCfg), "alice")
|
||||||
clientAlice.Serve()
|
clientAlice.Serve()
|
||||||
ra, err := clientAlice.RelayInstanceAddress()
|
ra, err := clientAlice.RelayInstanceAddress()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -283,3 +283,7 @@ func TestAutoReconnect(t *testing.T) {
|
|||||||
t.Errorf("failed to open channel: %s", err)
|
t.Errorf("failed to open channel: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func toURL(address server.ListenerConfig) string {
|
||||||
|
return "rel://" + address.Address
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user