From f16d228f6f54bda281f2e3496d8e2a78bb2428f5 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sat, 24 Aug 2024 20:43:20 +0200 Subject: [PATCH] connectClient now returns an error when unsuccessful. --- pkg/server/matchmaker/matchmaker_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/server/matchmaker/matchmaker_test.go b/pkg/server/matchmaker/matchmaker_test.go index 1e4d599..9ab88f7 100644 --- a/pkg/server/matchmaker/matchmaker_test.go +++ b/pkg/server/matchmaker/matchmaker_test.go @@ -149,7 +149,8 @@ func (s *MatchMakerTestSuite) Test_singleAgentAndClient() { waitForAgentFunc := s.registerAgent(publicId, agent) go waitForAgentFunc() - client, clientId := s.connectClient(publicId) + client, clientId, err := s.connectClient(publicId) + s.Nil(err) s.checkState(1, 1) @@ -167,10 +168,10 @@ func (s *MatchMakerTestSuite) Test_singleAgentAndClient() { s.checkState(1, 0) } -func (s *MatchMakerTestSuite) connectClient(publicId models.RendezVousId) (*TestClient, models.ClientId) { +func (s *MatchMakerTestSuite) connectClient(publicId models.RendezVousId) (*TestClient, models.ClientId, error) { client := NewTestClient(s.ctx) var clientId models.ClientId - testsupport.RunAndWait( + res := testsupport.RunAndWait( &s.Suite, func() any { //server @@ -181,13 +182,18 @@ func (s *MatchMakerTestSuite) connectClient(publicId models.RendezVousId) (*Test log.Println("test: synchronizing streams.") go synchronizer() } - return nil + return err }, func() any { // client, nothing to do with wsproxy mode off. return nil }) - return client, clientId + + var err error = nil + if res[0] != nil { + err = res[0].(error) + } + return client, clientId, err } func (s *MatchMakerTestSuite) checkState(nAgents int, nClients int) {