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

Function TestCreateOrUpdateStream

jetstream/test/jetstream_test.go:569–697  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

567}
568
569func TestCreateOrUpdateStream(t *testing.T) {
570 tests := []struct {
571 name string
572 stream string
573 subject string
574 timeout time.Duration
575 withError error
576 withInfoCheck bool
577 }{
578 {
579 name: "create stream ok",
580 stream: "foo",
581 timeout: 10 * time.Second,
582 subject: "FOO.1",
583 withInfoCheck: false,
584 },
585 {
586 name: "create stream empty context",
587 stream: "foo-o",
588 subject: "FOO.12",
589 withInfoCheck: false,
590 },
591 {
592 name: "create stream invalid stream name",
593 stream: "foo.123",
594 subject: "FOO-123",
595 timeout: 10 * time.Second,
596 withError: jetstream.ErrInvalidStreamName,
597 withInfoCheck: false,
598 },
599 {
600 name: "create stream stream name required",
601 stream: "",
602 subject: "FOO-1234",
603 timeout: 10 * time.Second,
604 withError: jetstream.ErrStreamNameRequired,
605 withInfoCheck: false,
606 },
607 {
608 name: "update stream ok",
609 stream: "foo",
610 subject: "BAR-123",
611 timeout: 10 * time.Second,
612 withInfoCheck: true,
613 },
614 {
615 name: "create stream context timeout",
616 stream: "foo",
617 subject: "BAR-1234",
618 timeout: 1 * time.Microsecond,
619 withError: context.DeadlineExceeded,
620 withInfoCheck: false,
621 },
622 {
623 name: "update stream with empty context",
624 stream: "sample-foo-1",
625 subject: "SAMPLE-FOO-123",
626 withInfoCheck: true,

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
ConnectMethod · 0.80
FatalfMethod · 0.80
RunBasicJetStreamServerFunction · 0.70
CreateOrUpdateStreamMethod · 0.65
InfoMethod · 0.65
CloseMethod · 0.45
IsMethod · 0.45

Tested by

no test coverage detected