From c42f7628d7869245621cf21ccb3ce7ff0f3628ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Wed, 24 Jul 2024 17:47:32 +0200 Subject: [PATCH] Fix test --- management/server/management_proto_test.go | 6 +++++- management/server/management_test.go | 6 +++++- management/server/token_mgr_test.go | 15 ++++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/management/server/management_proto_test.go b/management/server/management_proto_test.go index 7976e76e4..5aaf95344 100644 --- a/management/server/management_proto_test.go +++ b/management/server/management_proto_test.go @@ -419,7 +419,11 @@ func startManagement(t *testing.T, config *Config) (*grpc.Server, string, error) if err != nil { return nil, "", err } - turnManager := NewTimeBasedAuthSecretsManager(peersUpdateManager, config.TURNConfig, "") + + rc := &RelayConfig{ + Address: "localhost:0", + } + turnManager := NewTimeBasedAuthSecretsManager(peersUpdateManager, config.TURNConfig, rc) ephemeralMgr := NewEphemeralManager(store, accountManager) mgmtServer, err := NewServer(context.Background(), config, accountManager, peersUpdateManager, turnManager, nil, ephemeralMgr) diff --git a/management/server/management_test.go b/management/server/management_test.go index 1ef97f73b..af9a7eae4 100644 --- a/management/server/management_test.go +++ b/management/server/management_test.go @@ -546,7 +546,11 @@ func startServer(config *server.Config) (*grpc.Server, net.Listener) { if err != nil { log.Fatalf("failed creating a manager: %v", err) } - turnManager := server.NewTimeBasedAuthSecretsManager(peersUpdateManager, config.TURNConfig, "") + + rc := &server.RelayConfig{ + Address: "localhost:0", + } + turnManager := server.NewTimeBasedAuthSecretsManager(peersUpdateManager, config.TURNConfig, rc) mgmtServer, err := server.NewServer(context.Background(), config, accountManager, peersUpdateManager, turnManager, nil, nil) Expect(err).NotTo(HaveOccurred()) mgmtProto.RegisterManagementServiceServer(s, mgmtServer) diff --git a/management/server/token_mgr_test.go b/management/server/token_mgr_test.go index 6ac3571bb..debd798d0 100644 --- a/management/server/token_mgr_test.go +++ b/management/server/token_mgr_test.go @@ -23,11 +23,14 @@ func TestTimeBasedAuthSecretsManager_GenerateCredentials(t *testing.T) { secret := "some_secret" peersManager := NewPeersUpdateManager(nil) + rc := &RelayConfig{ + Address: "localhost:0", + } tested := NewTimeBasedAuthSecretsManager(peersManager, &TURNConfig{ CredentialsTTL: ttl, Secret: secret, Turns: []*Host{TurnTestHost}, - }, "") + }, rc) credentials, _ := tested.Generate() @@ -49,11 +52,14 @@ func TestTimeBasedAuthSecretsManager_SetupRefresh(t *testing.T) { peer := "some_peer" updateChannel := peersManager.CreateChannel(context.Background(), peer) + rc := &RelayConfig{ + Address: "localhost:0", + } tested := NewTimeBasedAuthSecretsManager(peersManager, &TURNConfig{ CredentialsTTL: ttl, Secret: secret, Turns: []*Host{TurnTestHost}, - }, "") + }, rc) tested.SetupRefresh(context.Background(), peer) @@ -97,11 +103,14 @@ func TestTimeBasedAuthSecretsManager_CancelRefresh(t *testing.T) { peersManager := NewPeersUpdateManager(nil) peer := "some_peer" + rc := &RelayConfig{ + Address: "localhost:0", + } tested := NewTimeBasedAuthSecretsManager(peersManager, &TURNConfig{ CredentialsTTL: ttl, Secret: secret, Turns: []*Host{TurnTestHost}, - }, "") + }, rc) tested.SetupRefresh(context.Background(), peer) if _, ok := tested.cancelMap[peer]; !ok {