Skip to content

Commit

Permalink
Fix call to stop containers when using parallel in JUnit Jupiter Exte…
Browse files Browse the repository at this point in the history
…nsion (#7394)

Currently, containers are shutdown because of JVMHookResourceReaper instead
of Ryuk when enabling parallel using `@Testcontainers`. This commits,
register containers to be initialized so `stop()` is called.
  • Loading branch information
eddumelendez committed Aug 3, 2023
1 parent add3711 commit d1a3742
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ private void startContainers(List<StoreAdapter> storeAdapters, Store store, Exte
}

if (isParallelExecutionEnabled(context)) {
Startables.deepStart(storeAdapters.stream().map(storeAdapter -> storeAdapter.container)).join();
Stream<Startable> startables = storeAdapters
.stream()
.map(storeAdapter -> {
store.getOrComputeIfAbsent(storeAdapter.getKey(), k -> storeAdapter);
return storeAdapter.container;
});
Startables.deepStart(startables).join();
} else {
storeAdapters.forEach(adapter -> store.getOrComputeIfAbsent(adapter.getKey(), k -> adapter.start()));
}
Expand Down

0 comments on commit d1a3742

Please sign in to comment.