fix up old test exhibiting a false positive

This commit is contained in:
cblgh 2021-04-12 16:34:45 +02:00 committed by Henry
parent 462f9be27f
commit dfddd63225
2 changed files with 8 additions and 5 deletions

View File

@ -33,9 +33,8 @@ func TestTunnelServerSimple(t *testing.T) {
botA := theBots[indexA].Server
botB := theBots[indexB].Server
// allow both clients
// only allow A
theBots[indexSrv].Members.Add(ctx, botA.Whoami(), roomdb.RoleMember)
theBots[indexSrv].Members.Add(ctx, botB.Whoami(), roomdb.RoleMember)
// allow bots to dial the remote
theBots[indexA].Members.Add(ctx, serv.Whoami(), roomdb.RoleMember)
@ -51,15 +50,15 @@ func TestTunnelServerSimple(t *testing.T) {
err = botB.Network.Connect(ctx, serv.Network.GetListenAddr())
r.NoError(err, "connect B to the Server") // we dont see an error because it just establishes the tcp connection
// t.Log("letting handshaking settle..")
// time.Sleep(1 * time.Second)
t.Log("letting handshaking settle..")
time.Sleep(1 * time.Second)
var srvWho struct {
ID refs.FeedRef
}
endpointB, has := botB.Network.GetEndpointFor(serv.Whoami())
r.False(has, "botB has an endpoint for the server!")
r.False(has, "botB has an endpoint for the server")
if endpointB != nil {
a.Nil(endpointB, "should not have an endpoint on B")
err = endpointB.Async(ctx, &srvWho, muxrpc.TypeJSON, muxrpc.Method{"whoami"})

View File

@ -94,6 +94,10 @@ func makeNamedTestBot(t testing.TB, name string, opts []roomsrv.Option) (roomdb.
t.Log("db close failed: ", err)
}
})
err = db.Config.SetPrivacyMode(context.TODO(), roomdb.ModeRestricted)
r.NoError(err)
sb := signinwithssb.NewSignalBridge()
theBot, err := roomsrv.New(db.Members, db.DeniedKeys, db.Aliases, db.AuthWithSSB, sb, db.Config, name, botOptions...)
r.NoError(err)