silenced race detector errors per #7484

This commit is contained in:
Gani Georgiev
2026-01-28 11:52:08 +02:00
parent b2bf26122f
commit 0e0b862bd7
3 changed files with 24 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ package subscriptions_test
import (
"encoding/json"
"strings"
"sync"
"testing"
"time"
@@ -208,12 +209,16 @@ func TestDiscard(t *testing.T) {
}
func TestSend(t *testing.T) {
var mu sync.Mutex
c := subscriptions.NewDefaultClient()
received := []string{}
go func() {
for m := range c.Channel() {
mu.Lock()
received = append(received, m.Name)
mu.Unlock()
}
}()
@@ -226,6 +231,8 @@ func TestSend(t *testing.T) {
expected := []string{"m1", "m2"}
mu.Lock()
defer mu.Unlock()
if len(received) != len(expected) {
t.Fatalf("Expected %d messages, got %d", len(expected), len(received))
}