Skip to content

Commit 6ccd686

Browse files
committed
[WFCORE-7271] Fix DeploymentScannerUnitTestCase intermittent failures
Jira issue: https://issues.redhat.com/browse/WFCORE-7271
1 parent b32a449 commit 6ccd686

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

testsuite/manualmode/src/test/java/org/jboss/as/test/manualmode/deployment/DeploymentScannerUnitTestCase.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ public void testStartup() throws Exception {
120120
Assert.assertEquals("OK", deploymentState(client, DEPLOYMENT_ONE));
121121

122122
timeout = System.currentTimeMillis() + TIMEOUT;
123-
while (exists(client, DEPLOYMENT_TWO) && System.currentTimeMillis() < timeout) {
123+
do {
124124
TimeUnit.SECONDS.sleep(TimeoutUtil.adjust(2));
125-
}
126-
Assert.assertFalse("Deployment two should exist at " + TIME_FORMATTER.format(LocalDateTime.now()), exists(client, DEPLOYMENT_TWO));
125+
} while (exists(client, DEPLOYMENT_TWO) && System.currentTimeMillis() < timeout);
126+
Assert.assertFalse("Deployment two should not exist at " + TIME_FORMATTER.format(LocalDateTime.now()), exists(client, DEPLOYMENT_TWO));
127127
ModelNode disableScanner = Util.getWriteAttributeOperation(PathAddress.parseCLIStyleAddress("/subsystem=deployment-scanner/scanner=testScanner"), "scan-interval", 300000);
128128
result = client.execute(disableScanner);
129129
assertEquals("Unexpected outcome of disabling the test deployment scanner: " + disableScanner, ModelDescriptionConstants.SUCCESS, result.get(OUTCOME).asString());
@@ -331,9 +331,10 @@ private PathAddress getScannerLoggerResourcePath() {
331331

332332
private void waitFor(String message, ExceptionWrappingSupplier<Boolean> condition) throws Exception {
333333
long timeout = System.currentTimeMillis() + TimeoutUtil.adjust(TIMEOUT);
334-
while (!condition.get() && System.currentTimeMillis() < timeout) {
334+
do {
335335
TimeUnit.SECONDS.sleep(TimeoutUtil.adjust(2));
336-
}
336+
} while (!condition.get() && System.currentTimeMillis() < timeout);
337+
337338
Assert.assertTrue(message, condition.get());
338339
}
339340

0 commit comments

Comments
 (0)