Skip to content

Commit

Permalink
Continue test if stream name gets created
Browse files Browse the repository at this point in the history
  • Loading branch information
nsurfer committed Feb 25, 2021
1 parent 9959afa commit ee948d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/js_test.go
Expand Up @@ -2544,7 +2544,10 @@ func withJSClusterAndStream(t *testing.T, clusterName string, size int, stream *
timeout := time.Now().Add(10 * time.Second)
for time.Now().Before(timeout) {
_, err = jsm.AddStream(stream)
if err != nil {
if err != nil && err.Error() == "stream name already in use" {
// Great, the stream was created.
break
} else if err != nil {
t.Logf("WARN: Got error while trying to create stream: %v", err)
// Backoff for a bit until cluster and resources ready.
time.Sleep(500 * time.Millisecond)
Expand Down

0 comments on commit ee948d9

Please sign in to comment.