Let a module stream declare work-queue retention (issue 1177)

This commit is contained in:
jochen
2026-10-19 02:11:05 +02:00
parent ffad53aad2
commit a069898c0c
6 changed files with 206 additions and 3 deletions
+22
View File
@@ -43,3 +43,25 @@ func TestWhatAModuleHearsIsComposedOntoTheStreamsSubjects(t *testing.T) {
t.Fatalf("the provider's stream: %+v", got)
}
}
// 1177/AC1: a catalogue stream declaring retention work-queue is carried into the broker's ModuleStream as
// WorkQueue, with its duplicate window.
func TestAWorkQueueStreamIsCarriedIntoTheBrokersModuleStream(t *testing.T) {
sender := catalogue.Manifest{Module: "mesh-mail", Streams: []catalogue.StreamDeclaration{{Name: "mail-sends",
Events: []string{"mail.send.approved"}, MaxAgeDays: 1, MaxMiB: 64,
Retention: catalogue.StreamRetentionWorkQueue, MaxDeliveries: 5, Duplicates: 24}}}
got := streamsOf(sender)
if len(got) != 1 || got[0].Name != "MAIL_SENDS" || !got[0].WorkQueue || got[0].Duplicates != 24 {
t.Fatalf("the sender's stream: %+v", got)
}
}
// 1177/AC3: a catalogue stream with no retention is carried into the broker as not a work queue.
func TestANonWorkQueueStreamIsCarriedAsNotAWorkQueue(t *testing.T) {
plain := catalogue.Manifest{Module: "feed", Streams: []catalogue.StreamDeclaration{{Name: "items",
Events: []string{"item.**"}}}}
got := streamsOf(plain)
if len(got) != 1 || got[0].WorkQueue || got[0].Duplicates != 0 {
t.Fatalf("the plain stream: %+v", got)
}
}