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

Function TestJetStreamStreamInfoAlternates

test/js_test.go:10242–10269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10240}
10241
10242func TestJetStreamStreamInfoAlternates(t *testing.T) {
10243 withJSCluster(t, "R3S", 3, func(t *testing.T, nodes ...*jsServer) {
10244 nc, js := jsClient(t, nodes[0].Server)
10245 defer nc.Close()
10246
10247 _, err := js.AddStream(&nats.StreamConfig{
10248 Name: "TEST",
10249 Subjects: []string{"foo"},
10250 })
10251 expectOk(t, err)
10252
10253 // Create a mirror as well.
10254 _, err = js.AddStream(&nats.StreamConfig{
10255 Name: "MIRROR",
10256 Mirror: &nats.StreamSource{
10257 Name: "TEST",
10258 },
10259 })
10260 expectOk(t, err)
10261
10262 si, err := js.StreamInfo("TEST")
10263 expectOk(t, err)
10264
10265 if len(si.Alternates) != 2 {
10266 t.Fatalf("Expected 2 alternates, got %d", len(si.Alternates))
10267 }
10268 })
10269}
10270
10271func TestJetStreamSubscribeConsumerName(t *testing.T) {
10272 s := RunBasicJetStreamServer()

Callers

nothing calls this directly

Calls 7

FatalfMethod · 0.80
withJSClusterFunction · 0.70
jsClientFunction · 0.70
expectOkFunction · 0.70
AddStreamMethod · 0.65
StreamInfoMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected