Skip to content

Commit

Permalink
[WFCORE-6685] CLIEmbedServerTestCase.testStdOutEcho fails intermittently
Browse files Browse the repository at this point in the history
  • Loading branch information
lvydra committed Feb 21, 2024
1 parent 2b81468 commit dbacadf
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private void stdoutTest(String paramVal) throws Exception {
String line = "embed-server --admin-only=false --server-config=standalone-cli.xml " + stdoutParam + JBOSS_HOME;
cli.sendLine(line);
if (expectServerLogging) {
checkLogging("WFLYSRV0025");
checkLogging("WFLYSRV0025", TimeoutUtil.adjust(30000));
} else {
checkNoLogging("WFLYSRV0025");
}
Expand Down Expand Up @@ -249,7 +249,7 @@ private void stdoutTest(String paramVal) throws Exception {

}

private void checkClientSideLogging() throws IOException {
private void checkClientSideLogging() throws IOException, InterruptedException {
String text = "test." + System.nanoTime();
Logger.getLogger(text).error(text);
checkLogging(text);
Expand Down Expand Up @@ -525,7 +525,7 @@ public void testStopServerOnTerminateSession() throws IOException {
* Tests the --help param works.
*/
@Test
public void testHelp() throws IOException {
public void testHelp() throws IOException, InterruptedException {
cli.sendLine("embed-server --help");
checkLogging("embed-server");

Expand Down Expand Up @@ -725,8 +725,20 @@ private String readLogOut() {
return null;
}

private void checkLogging(String line) throws IOException {
private void checkLogging(String line) throws IOException, InterruptedException {
checkLogging(line, 0);
}

private void checkLogging(String line, int timeout) throws IOException, InterruptedException {
String logOutput = readLogOut();
long done = System.currentTimeMillis() + timeout;
while (timeout > 0 && System.currentTimeMillis() < done) {
if (checkLogging(logOutput, line)) {
break;
} else {
Thread.sleep(20);
}
}
assertTrue(logOutput, checkLogging(logOutput, line));
}

Expand Down

0 comments on commit dbacadf

Please sign in to comment.