now also testing client removal.

This commit is contained in:
Erik Brakkee 2024-08-22 17:33:54 +02:00
parent 4e2265c1b3
commit 8fcdf5711f

View File

@ -190,11 +190,16 @@ func (s *AdminTestSuite) Test_connectClient() {
s.Equal(1, len(state.Clients)) s.Equal(1, len(state.Clients))
s.Equal(clientConn.Info, state.Clients[clientConn.Info.Guid]) s.Equal(clientConn.Info, state.Clients[clientConn.Info.Guid])
// will close the connections and as a result also th synchronize goroutine. // removing the client will close all connections, we test this by writing to the connections
s.cancelFunc() // after removing the client.
s.admin.RemoveClient(clientConn)
// Note: removing agents and clients after connection loss is the responsibility of the MatchMaker buf := make([]byte, 10)
// Here we only test explicit removal of the agents and clients. _, err := clientConn.clientConnection.Write(buf)
s.NotNil(err)
s.True(strings.Contains(err.Error(), "closed"))
_, err = clientConn.agentConnection.Write(buf)
s.NotNil(err)
s.True(strings.Contains(err.Error(), "closed"))
} }
func (s *AdminTestSuite) Test_multipleAgentsAndClients() { func (s *AdminTestSuite) Test_multipleAgentsAndClients() {