Skip to content

Commit 50018fb

Browse files
committed
chore: Use wait strategy default configuration
1 parent f6d1e0f commit 50018fb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Testcontainers.MongoDb/MongoDbBuilder.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ private async Task InitiateReplicaSetAsync(MongoDbContainer container, MongoDbCo
165165
return;
166166
}
167167

168+
// This is a simple workaround to use the default options, which can be configured
169+
// with custom configurations as needed.
170+
var options = new WaitStrategy();
171+
168172
var scriptContent = $"var r=rs.initiate({{_id:\"{configuration.ReplicaSetName}\",members:[{{_id:0,host:\"127.0.0.1:27017\"}}]}});quit(r.ok===1?0:1);";
169173

170174
var initiate = async () =>
@@ -173,9 +177,9 @@ private async Task InitiateReplicaSetAsync(MongoDbContainer container, MongoDbCo
173177
.ConfigureAwait(false);
174178

175179
return 0L.Equals(execResult.ExitCode);
176-
};
180+
};
177181

178-
await WaitStrategy.WaitUntilAsync(initiate, TimeSpan.FromSeconds(2), TimeSpan.FromMinutes(5), -1, ct)
182+
await WaitStrategy.WaitUntilAsync(initiate, options.Interval, options.Timeout, options.Retries, ct)
179183
.ConfigureAwait(false);
180184
}
181185

0 commit comments

Comments
 (0)