Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements. Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate. Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable. Refs: Versioned dependencies U1/U3; feature/dependency-workspace
38 lines
701 B
Go
38 lines
701 B
Go
package bus
|
|
|
|
import (
|
|
"testing"
|
|
|
|
core "git-ssh.u1680832.nyat.app/weichen/Agent-System-Core.git"
|
|
)
|
|
|
|
func TestPublishClosesOverflowedSubscriber(t *testing.T) {
|
|
b := NewWithBuffer(1)
|
|
ch, unsub := b.Subscribe("c1")
|
|
defer unsub()
|
|
b.Publish(core.StreamEvent{ConversationID: "c1", Seq: 1, Type: "a"})
|
|
b.Publish(core.StreamEvent{ConversationID: "c1", Seq: 2, Type: "b"})
|
|
n := 0
|
|
for {
|
|
e, ok := <-ch
|
|
if !ok {
|
|
break
|
|
}
|
|
n++
|
|
if e.Seq != 1 {
|
|
t.Fatalf("buffered event seq %d", e.Seq)
|
|
}
|
|
}
|
|
if n != 1 {
|
|
t.Fatalf("delivered %d events before close", n)
|
|
}
|
|
unsub()
|
|
}
|
|
|
|
func TestUnsubscribeIsIdempotent(t *testing.T) {
|
|
b := NewWithBuffer(1)
|
|
_, unsub := b.Subscribe("c1")
|
|
unsub()
|
|
unsub()
|
|
}
|