fix: removing assertStopped (#33312)

closes: #26454

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
Steven Hawkins 2024-09-27 07:40:54 -04:00 committed by GitHub
parent 65464a4244
commit c92dc98b90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1 additions and 33 deletions

View file

@ -77,7 +77,6 @@ public class FipsDistTest {
runOnFipsEnabledDistribution(dist, () -> { runOnFipsEnabledDistribution(dist, () -> {
dist.copyOrReplaceFileFromClasspath("/server.keystore", Path.of("conf", "server.keystore")); dist.copyOrReplaceFileFromClasspath("/server.keystore", Path.of("conf", "server.keystore"));
CLIResult cliResult = dist.run("start", "--fips-mode=strict"); CLIResult cliResult = dist.run("start", "--fips-mode=strict");
dist.assertStopped();
cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence"); cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence");
}); });
} }
@ -125,7 +124,6 @@ public class FipsDistTest {
runOnFipsEnabledDistribution(dist, () -> { runOnFipsEnabledDistribution(dist, () -> {
dist.copyOrReplaceFileFromClasspath("/server.keystore.pkcs12", Path.of("conf", "server.keystore")); dist.copyOrReplaceFileFromClasspath("/server.keystore.pkcs12", Path.of("conf", "server.keystore"));
CLIResult cliResult = dist.run("start", "--fips-mode=strict", "--https-key-store-password=passwordpassword"); CLIResult cliResult = dist.run("start", "--fips-mode=strict", "--https-key-store-password=passwordpassword");
dist.assertStopped();
cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence"); cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence");
}); });
} }

View file

@ -121,11 +121,6 @@ public class KeycloakDistributionDecorator implements KeycloakDistribution {
delegate.copyOrReplaceFile(file, targetFile); delegate.copyOrReplaceFile(file, targetFile);
} }
@Override
public void assertStopped() {
delegate.assertStopped();
}
@Override @Override
public void setRequestPort() { public void setRequestPort() {
delegate.setRequestPort(); delegate.setRequestPort();

View file

@ -269,8 +269,4 @@ public final class DockerKeycloakDistribution implements KeycloakDistribution {
throw new IllegalArgumentException("Not a " + type + " type"); throw new IllegalArgumentException("Not a " + type + " type");
} }
@Override
public void assertStopped() {
// not implemented
}
} }

View file

@ -28,8 +28,6 @@ public interface KeycloakDistribution {
boolean isManualStop(); boolean isManualStop();
void assertStopped();
void setRequestPort(); void setRequestPort();
void setRequestPort(int port); void setRequestPort(int port);

View file

@ -43,11 +43,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.LockSupport;
import java.util.function.Consumer; import java.util.function.Consumer;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
@ -217,6 +215,7 @@ public final class RawKeycloakDistribution implements KeycloakDistribution {
} catch (Exception cause) { } catch (Exception cause) {
destroyDescendantsOnWindows(keycloak, true); destroyDescendantsOnWindows(keycloak, true);
keycloak.destroyForcibly(); keycloak.destroyForcibly();
threadDump();
throw new RuntimeException("Failed to stop the server", cause); throw new RuntimeException("Failed to stop the server", cause);
} }
} }
@ -304,24 +303,6 @@ public final class RawKeycloakDistribution implements KeycloakDistribution {
return allArgs.toArray(String[]::new); return allArgs.toArray(String[]::new);
} }
@Override
public void assertStopped() {
try {
if (keycloak != null) {
keycloak.onExit().get(DEFAULT_SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
LOG.warn("Process did not exit as expected, will attempt a thread dump");
threadDump();
throw new RuntimeException(e);
}
}
@Override @Override
public void setRequestPort() { public void setRequestPort() {
setRequestPort(requestPort); setRequestPort(requestPort);