mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Test server's client map
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type serverInfo struct {
|
||||
@@ -375,3 +376,17 @@ func TestClientRemoveSubsOnDisconnect(t *testing.T) {
|
||||
t.Fatalf("Should have no subscriptions after close, got %d\n", s.sl.Count())
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientMapRemoval(t *testing.T) {
|
||||
s, c, _ := setupClient()
|
||||
c.conn.Close()
|
||||
end := time.Now().Add(1 * time.Second)
|
||||
for time.Now().Before(end) {
|
||||
if len(s.clients) > 0 {
|
||||
time.Sleep(5 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
if len(s.clients) > 0 {
|
||||
t.Fatal("Client still in server map")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user