Skip to content

Commit

Permalink
use vthread exec for smoke
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed May 26, 2024
1 parent 54fa1f4 commit 4565a8d
Showing 1 changed file with 40 additions and 24 deletions.
64 changes: 40 additions & 24 deletions model/src/test/java/com/salesforce/apollo/model/DomainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Arrays;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand Down Expand Up @@ -90,30 +91,45 @@ public static void smoke(Oracle oracle) throws Exception {

var countDown = new CountDownLatch(17);

retryNesting(() -> oracle.map(helpDeskMembers, adminMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(ali, adminMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(ali, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(burcu, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(can, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(managerMembers, userMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(technicianMembers, userMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(demet, helpDeskMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(egin, helpDeskMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(egin, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(fuat, managerMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(gl, managerMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(hakan, technicianMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(irmak, technicianMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(abcTechMembers, technicianMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(flaggedTechnicianMembers, technicianMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown());
retryNesting(() -> oracle.map(jale, abcTechMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown());

countDown.await(120, TimeUnit.SECONDS);
try (var exec = Executors.newVirtualThreadPerTaskExecutor()) {

retryNesting(() -> oracle.map(helpDeskMembers, adminMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown(), exec);
retryNesting(() -> oracle.map(ali, adminMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(ali, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(burcu, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(can, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(managerMembers, userMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown(), exec);
retryNesting(() -> oracle.map(technicianMembers, userMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown(), exec);
retryNesting(() -> oracle.map(demet, helpDeskMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(egin, helpDeskMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(egin, userMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(fuat, managerMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(gl, managerMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);
retryNesting(() -> oracle.map(hakan, technicianMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown(), exec);
retryNesting(() -> oracle.map(irmak, technicianMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown(), exec);
retryNesting(() -> oracle.map(abcTechMembers, technicianMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown(), exec);
retryNesting(() -> oracle.map(flaggedTechnicianMembers, technicianMembers), 3).whenCompleteAsync(
(_, _) -> countDown.countDown(), exec);
retryNesting(() -> oracle.map(jale, abcTechMembers), 3).whenCompleteAsync((_, _) -> countDown.countDown(),
exec);

countDown.await(120, TimeUnit.SECONDS);
}

// Protected resource namespace
var docNs = Oracle.namespace("Document");
Expand Down

0 comments on commit 4565a8d

Please sign in to comment.