package live import "testing" func TestSampleOutputQueueDropsWhenFull(t *testing.T) { session := &session{outbound: make(chan []byte, 1)} session.outbound <- []byte("queued") message := SamplesMessage{SchemaVersion: 1, Type: "samples", SubscriptionID: "sub", Sequence: 1, Samples: []Sample{}} if err := session.send(message); err != nil { t.Fatalf("sample drop should preserve session health: %v", err) } if len(session.outbound) != 1 { t.Fatalf("queue length=%d, want bounded length 1", len(session.outbound)) } }