Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions internal/ipc/extra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,24 @@ func TestBroadcastEvent_Delivery(t *testing.T) {
}
defer rawConn.Close()

// Wait until the server has tracked the connection before broadcasting,
// otherwise the event is sent to an empty set of connections.
ticker := time.NewTicker(5 * time.Millisecond)
defer ticker.Stop()
for {
srv.mu.Lock()
tracked := len(srv.conns)
srv.mu.Unlock()
if tracked > 0 {
break
}
select {
case <-ctx.Done():
t.Fatal("timed out waiting for server to track connection")
case <-ticker.C:
}
Comment thread
darkliquid marked this conversation as resolved.
}

// Broadcast an event.
srv.BroadcastEvent(&ipcv1.Event{
Kind: &ipcv1.Event_IndexUpdated{IndexUpdated: &ipcv1.IndexUpdatedEvent{}},
Expand Down
Loading