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

Function waitForJSReady

test/js_test.go:6562–6579  ·  view source on GitHub ↗
(t *testing.T, nc *nats.Conn)

Source from the content-addressed store, hash-verified

6560}
6561
6562func waitForJSReady(t *testing.T, nc *nats.Conn) {
6563 var err error
6564 timeout := time.Now().Add(10 * time.Second)
6565 for time.Now().Before(timeout) {
6566 // Use a smaller MaxWait here since if it fails, we don't want
6567 // to wait for too long since we are going to try again.
6568 js, err := nc.JetStream(nats.MaxWait(250 * time.Millisecond))
6569 if err != nil {
6570 t.Fatal(err)
6571 }
6572 _, err = js.AccountInfo()
6573 if err != nil {
6574 continue
6575 }
6576 return
6577 }
6578 t.Fatalf("Timeout waiting for JS to be ready: %v", err)
6579}
6580
6581func waitForJSClusterReady(t *testing.T, nodes []*jsServer, size int) {
6582 t.Helper()

Callers 1

setupJSClusterWithSizeFunction · 0.70

Calls 4

JetStreamMethod · 0.80
FatalfMethod · 0.80
AddMethod · 0.65
AccountInfoMethod · 0.65

Tested by

no test coverage detected