Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void startMongoDatabase() throws IOException {
.version(version)
.net(new Net(port, Network.localhostIsIPv6()))
.build();
MONGO = MongodStarter.getDefaultInstance().prepare(config);
MONGO = getMongodExecutable(config);
try {
MONGO.start();
} catch (Exception e) {
Expand All @@ -65,6 +65,24 @@ public static void startMongoDatabase() throws IOException {
}
}

private static MongodExecutable getMongodExecutable(IMongodConfig config) {
try {
return doGetExecutable(config);
} catch (Exception e) {
// sometimes the download process can timeout so just sleep and try again
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {

}
return doGetExecutable(config);
}
}

private static MongodExecutable doGetExecutable(IMongodConfig config) {
return MongodStarter.getDefaultInstance().prepare(config);
}

@AfterAll
public static void stopMongoDatabase() {
if (MONGO != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void startMongoDatabase() throws IOException {
configs.add(buildMongodConfiguration("localhost", port, true));
}
configs.forEach(config -> {
MongodExecutable exec = MongodStarter.getDefaultInstance().prepare(config);
MongodExecutable exec = getMongodExecutable(config);
MONGOS.add(exec);
try {
try {
Expand All @@ -70,6 +70,24 @@ public static void startMongoDatabase() throws IOException {
}
}

private static MongodExecutable getMongodExecutable(IMongodConfig config) {
try {
return doGetExecutable(config);
} catch (Exception e) {
// sometimes the download process can timeout so just sleep and try again
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {

}
return doGetExecutable(config);
}
}

private static MongodExecutable doGetExecutable(IMongodConfig config) {
return MongodStarter.getDefaultInstance().prepare(config);
}

@AfterAll
public static void stopMongoDatabase() {
MONGOS.forEach(mongod -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void startMongoDatabase() throws IOException {
.version(version)
.net(new Net(port, Network.localhostIsIPv6()))
.build();
MONGO = MongodStarter.getDefaultInstance().prepare(config);
MONGO = getMongodExecutable(config);
try {
MONGO.start();
} catch (Exception e) {
Expand All @@ -77,6 +77,24 @@ public static void startMongoDatabase() throws IOException {
}
}

private static MongodExecutable getMongodExecutable(IMongodConfig config) {
try {
return doGetExecutable(config);
} catch (Exception e) {
// sometimes the download process can timeout so just sleep and try again
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {

}
return doGetExecutable(config);
}
}

private static MongodExecutable doGetExecutable(IMongodConfig config) {
return MongodStarter.getDefaultInstance().prepare(config);
}

@AfterAll
public static void stopMongoDatabase() {
if (MONGO != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void startMongoDatabase() throws IOException {
configs.add(buildMongodConfiguration("localhost", port, true));
}
configs.forEach(config -> {
MongodExecutable exec = MongodStarter.getDefaultInstance().prepare(config);
MongodExecutable exec = getMongodExecutable(config);
MONGOS.add(exec);
try {
try {
Expand All @@ -70,6 +70,24 @@ public static void startMongoDatabase() throws IOException {
}
}

private static MongodExecutable getMongodExecutable(IMongodConfig config) {
try {
return doGetExecutable(config);
} catch (Exception e) {
// sometimes the download process can timeout so just sleep and try again
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {

}
return doGetExecutable(config);
}
}

private static MongodExecutable doGetExecutable(IMongodConfig config) {
return MongodStarter.getDefaultInstance().prepare(config);
}

@AfterAll
public static void stopMongoDatabase() {
MONGOS.forEach(mongod -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Map<String, String> start() {
.version(version)
.net(new Net(port, Network.localhostIsIPv6()))
.build();
MONGO = MongodStarter.getDefaultInstance().prepare(config);
MONGO = getMongodExecutable(config);
try {
MONGO.start();
} catch (Exception e) {
Expand All @@ -45,6 +45,24 @@ public Map<String, String> start() {
return Collections.emptyMap();
}

private MongodExecutable getMongodExecutable(IMongodConfig config) {
try {
return doGetExecutable(config);
} catch (Exception e) {
// sometimes the download process can timeout so just sleep and try again
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {

}
return doGetExecutable(config);
}
}

private MongodExecutable doGetExecutable(IMongodConfig config) {
return MongodStarter.getDefaultInstance().prepare(config);
}

@Override
public void stop() {
if (MONGO != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Map<String, String> start() {
.version(version)
.net(new Net(port, Network.localhostIsIPv6()))
.build();
MONGO = MongodStarter.getDefaultInstance().prepare(config);
MONGO = getMongodExecutable(config);
try {
MONGO.start();
} catch (Exception e) {
Expand All @@ -44,6 +44,24 @@ public Map<String, String> start() {
}
}

private MongodExecutable getMongodExecutable(IMongodConfig config) {
try {
return doGetExecutable(config);
} catch (Exception e) {
// sometimes the download process can timeout so just sleep and try again
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {

}
return doGetExecutable(config);
}
}

private MongodExecutable doGetExecutable(IMongodConfig config) {
return MongodStarter.getDefaultInstance().prepare(config);
}

@Override
public void stop() {
if (MONGO != null) {
Expand Down