O-5: C-S6: stateobjects.Sender and Receive, a reply or an event over the message limit sent as the reference of an object in the sender's store of sent objects (milestone 47/G, issue 1966, ADR 0666 section 16)
Builds: design 47 G §59, §407 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
package stateobjects
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -35,5 +37,23 @@ func TestStateObjectsWholeAgainstTheBus(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sent, err := js.CreateObjectStore(ctx, jetstream.ObjectStoreConfig{Bucket: "m_sent-objects", Storage: jetstream.MemoryStorage, TTL: 7 * 24 * time.Hour})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Run("a reply and an event over the message limit", func(t *testing.T) {
|
||||
s := Sender{Objects: BusObjects{Store: sent}, Store: "m_sent-objects", Limit: int(nc.MaxPayload())}
|
||||
for _, label := range []string{"reply.list", "event.done"} {
|
||||
body := []byte(`{"text":"` + strings.Repeat("y", 3<<20) + `"}`)
|
||||
wire, err := s.Send(label, body)
|
||||
if err != nil || len(wire) > int(nc.MaxPayload()) {
|
||||
t.Fatalf("%s: sent %d bytes, %v", label, len(wire), err)
|
||||
}
|
||||
got, err := Receive(wire, ProcessFetch(BusObjects{Store: sent}))
|
||||
if err != nil || !bytes.Equal(got, body) {
|
||||
t.Fatalf("%s: received %d bytes, %v", label, len(got), err)
|
||||
}
|
||||
}
|
||||
})
|
||||
t.Run("values of 1x, 10x and 100x the limit", func(t *testing.T) { valueRows(t, OverBus(kv, store, "m_views-objects")) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user