MCPcopy
hub / github.com/nats-io/nats.go / TestStreamInfo

Function TestStreamInfo

jetstream/test/stream_test.go:631–752  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

629}
630
631func TestStreamInfo(t *testing.T) {
632 tests := []struct {
633 name string
634 subjectsFilter string
635 expectedSubjectMsgs map[string]uint64
636 deletedDetails bool
637 timeout time.Duration
638 withError error
639 }{
640 {
641 name: "info without opts",
642 timeout: 5 * time.Second,
643 },
644 {
645 name: "with empty context",
646 },
647 {
648 name: "with deleted details",
649 deletedDetails: true,
650 timeout: 5 * time.Second,
651 },
652 {
653 name: "with subjects filter, one subject",
654 subjectsFilter: "FOO.A",
655 timeout: 5 * time.Second,
656 expectedSubjectMsgs: map[string]uint64{"FOO.A": 8},
657 },
658 {
659 name: "with subjects filter, wildcard subject",
660 subjectsFilter: "FOO.*",
661 timeout: 5 * time.Second,
662 expectedSubjectMsgs: map[string]uint64{"FOO.A": 8, "FOO.B": 10},
663 },
664 {
665 name: "with subjects filter, and deleted details",
666 subjectsFilter: "FOO.A",
667 timeout: 5 * time.Second,
668 expectedSubjectMsgs: map[string]uint64{"FOO.A": 8},
669 },
670 {
671 name: "context timeout",
672 timeout: 1 * time.Microsecond,
673 withError: context.DeadlineExceeded,
674 },
675 }
676
677 srv := RunBasicJetStreamServer()
678 defer shutdownJSServerAndRemoveStorage(t, srv)
679 nc, err := nats.Connect(srv.ClientURL())
680 if err != nil {
681 t.Fatalf("Unexpected error: %v", err)
682 }
683
684 js, err := jetstream.New(nc)
685 if err != nil {
686 t.Fatalf("Unexpected error: %v", err)
687 }
688 defer nc.Close()

Callers

nothing calls this directly

Calls 13

NewFunction · 0.92
WithDeletedDetailsFunction · 0.92
WithSubjectFilterFunction · 0.92
ConnectMethod · 0.80
FatalfMethod · 0.80
RunBasicJetStreamServerFunction · 0.70
CreateStreamMethod · 0.65
PublishMethod · 0.65
DeleteMsgMethod · 0.65
InfoMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected