Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Have a minimum timeout, otherwise it fails when create too few users/assets (#2589)

Eric Bariauxca2e54211298
diff --git a/setup/src/load2/java/org/openremote/setup/load2/KeycloakSetup.java b/setup/src/load2/java/org/openremote/setup/load2/KeycloakSetup.java
index e233ced2b..36e0fa0e6 100644
--- a/setup/src/load2/java/org/openremote/setup/load2/KeycloakSetup.java
+++ b/setup/src/load2/java/org/openremote/setup/load2/KeycloakSetup.java
@@ -89,10 +89,10 @@ public class KeycloakSetup extends AbstractKeycloakSetup {
// Wait until all users created
int waitCounter = 0;
- int waitCounterLimit = accounts / 3;
+ int waitCounterLimit = Math.max(300, accounts / 3);
while (createdUsers.get() < 2 * accounts) {
if (waitCounter > waitCounterLimit) {
- throw new IllegalStateException("Failed to add all requested user in the specified time");
+ throw new IllegalStateException("Failed to add all requested user in the specified time (" + waitCounterLimit + " seconds).");
}
waitCounter++;
Thread.sleep(1000);
diff --git a/setup/src/load2/java/org/openremote/setup/load2/ManagerSetup.java b/setup/src/load2/java/org/openremote/setup/load2/ManagerSetup.java
index c8d85dfd4..5ebcb89c9 100644
--- a/setup/src/load2/java/org/openremote/setup/load2/ManagerSetup.java
+++ b/setup/src/load2/java/org/openremote/setup/load2/ManagerSetup.java
@@ -98,10 +98,10 @@ public class ManagerSetup extends org.openremote.manager.setup.ManagerSetup {
// Wait until all devices created
int waitCounter = 0;
- int waitCounterLimit = (accounts * assets) / 150;
+ int waitCounterLimit = Math.max(60, (accounts * assets) / 150);
while (createdAccounts.get() < accounts) {
if (waitCounter > waitCounterLimit) {
- throw new IllegalStateException("Failed to provision all requested devices in the specified time");
+ throw new IllegalStateException("Failed to provision all requested devices in the specified time (" + (waitCounterLimit * 10) + " seconds).");
}
waitCounter++;
Thread.sleep(10000);