Skip to content

Commit

Permalink
Retry flaky couchbase 3.1 startup (#12873)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Dec 10, 2024
1 parent 96eccaf commit 919661f
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ class CouchbaseClient31Test {

@BeforeAll
static void setup() {
// wait and retry in the hope that it will help against test flakiness
await()
.atMost(Duration.ofMinutes(5))
.ignoreException(UnambiguousTimeoutException.class)
.until(
() -> {
startCouchbase();
return true;
});
}

private static void startCouchbase() {
couchbase =
new CouchbaseContainer("couchbase/server:7.6.0")
.withExposedPorts(8091)
Expand All @@ -65,18 +77,11 @@ static void setup() {
ClusterOptions.clusterOptions(couchbase.getUsername(), couchbase.getPassword())
.environment(environment));

// wait and retry in the hope that it will help against test flakiness
await()
.atMost(Duration.ofMinutes(2))
.ignoreException(UnambiguousTimeoutException.class)
.until(
() -> {
Bucket bucket = cluster.bucket("test");
collection = bucket.defaultCollection();
Bucket bucket = cluster.bucket("test");
collection = bucket.defaultCollection();

bucket.waitUntilReady(Duration.ofSeconds(30));
return true;
});
// Wait 1 minute due to slow startup contributing to flakiness
bucket.waitUntilReady(Duration.ofMinutes(1));
}

@AfterAll
Expand Down

0 comments on commit 919661f

Please sign in to comment.