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

Function waitForJSClusterReady

test/js_test.go:6581–6593  ·  view source on GitHub ↗
(t *testing.T, nodes []*jsServer, size int)

Source from the content-addressed store, hash-verified

6579}
6580
6581func waitForJSClusterReady(t *testing.T, nodes []*jsServer, size int) {
6582 t.Helper()
6583 timeout := time.Now().Add(10 * time.Second)
6584 for time.Now().Before(timeout) {
6585 for _, n := range nodes {
6586 if n.JetStreamIsLeader() && len(n.JetStreamClusterPeers()) == size {
6587 return
6588 }
6589 }
6590 time.Sleep(50 * time.Millisecond)
6591 }
6592 t.Fatalf("Timeout waiting for JS cluster of size %d to be ready", size)
6593}
6594
6595func checkFor(t *testing.T, totalWait, sleepDur time.Duration, f func() error) {
6596 t.Helper()

Callers 1

setupJSClusterWithSizeFunction · 0.85

Calls 2

FatalfMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected