(t *testing.T)
| 629 | } |
| 630 | |
| 631 | func 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() |
nothing calls this directly
no test coverage detected