Skip to content

Commit

Permalink
Merge pull request #32132 from gsmet/2.16.6-backports-1
Browse files Browse the repository at this point in the history
2.16.6 backports 1
  • Loading branch information
gsmet authored Apr 3, 2023
2 parents c49a97e + 9dbfe9c commit 6e95bcf
Show file tree
Hide file tree
Showing 58 changed files with 899 additions and 332 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
<jna.version>5.8.0</jna.version><!-- should satisfy both testcontainers and mongodb -->
<antlr.version>4.10.1</antlr.version><!-- needs to align with same property in build-parent/pom.xml -->
<quarkus-security.version>1.1.4.Final</quarkus-security.version>
<keycloak.version>20.0.3</keycloak.version>
<keycloak.version>21.0.1</keycloak.version>
<logstash-gelf.version>1.15.0</logstash-gelf.version>
<checker-qual.version>3.29.0</checker-qual.version>
<error-prone-annotations.version>2.17.0</error-prone-annotations.version>
Expand Down
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

<!-- The image to use for tests that run Keycloak -->
<!-- IMPORTANT: If this is changed you must also update bom/application/pom.xml and KeycloakBuildTimeConfig/DevServicesConfig in quarkus-oidc/deployment to match the version -->
<keycloak.version>20.0.3</keycloak.version>
<keycloak.version>21.0.1</keycloak.version>
<keycloak.wildfly.version>19.0.3</keycloak.wildfly.version>
<keycloak.docker.image>quay.io/keycloak/keycloak:${keycloak.version}</keycloak.docker.image>
<keycloak.docker.legacy.image>quay.io/keycloak/keycloak:${keycloak.wildfly.version}-legacy</keycloak.docker.legacy.image>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

package io.quarkus.deployment;

import java.io.File;
import static io.quarkus.runtime.util.ContainerRuntimeUtil.ContainerRuntime.UNAVAILABLE;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand All @@ -11,23 +12,20 @@
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;

import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;

import io.quarkus.deployment.console.StartupLogCompressor;
import io.quarkus.deployment.util.ExecUtil;
import io.quarkus.runtime.util.ContainerRuntimeUtil;

public class IsDockerWorking implements BooleanSupplier {

private static final Logger LOGGER = Logger.getLogger(IsDockerWorking.class.getName());
public static final int DOCKER_HOST_CHECK_TIMEOUT = 1000;
public static final int DOCKER_CMD_CHECK_TIMEOUT = 3000;

private final List<Strategy> strategies;

Expand All @@ -36,8 +34,7 @@ public IsDockerWorking() {
}

public IsDockerWorking(boolean silent) {
this.strategies = List.of(new TestContainersStrategy(silent), new DockerHostStrategy(),
new DockerBinaryStrategy(silent));
this.strategies = List.of(new TestContainersStrategy(silent), new DockerHostStrategy(), new DockerBinaryStrategy());
}

@Override
Expand Down Expand Up @@ -170,41 +167,11 @@ public Result get() {

private static class DockerBinaryStrategy implements Strategy {

private final boolean silent;
private final String binary;

private DockerBinaryStrategy(boolean silent) {
this.silent = silent;
this.binary = ConfigProvider.getConfig().getOptionalValue("quarkus.docker.executable-name", String.class)
.orElse("docker");
}

@Override
public Result get() {
try {
if (!ExecUtil.execSilentWithTimeout(Duration.ofMillis(DOCKER_CMD_CHECK_TIMEOUT), binary, "-v")) {
LOGGER.warnf("'%s -v' returned an error code. Make sure your Docker binary is correct", binary);
return Result.UNKNOWN;
}
} catch (Exception e) {
LOGGER.warnf("No %s binary found or general error: %s", binary, e);
return Result.UNKNOWN;
}

try {
OutputFilter filter = new OutputFilter();
if (ExecUtil.execWithTimeout(new File("."), filter, Duration.ofMillis(DOCKER_CMD_CHECK_TIMEOUT),
"docker", "version", "--format", "'{{.Server.Version}}'")) {
LOGGER.debugf("Docker daemon found. Version: %s", filter.getOutput());
return Result.AVAILABLE;
} else {
if (!silent) {
LOGGER.warn("Could not determine version of Docker daemon");
}
return Result.UNAVAILABLE;
}
} catch (Exception e) {
LOGGER.warn("Unexpected error occurred while determining Docker daemon version", e);
if (ContainerRuntimeUtil.detectContainerRuntime(false) != UNAVAILABLE) {
return Result.AVAILABLE;
} else {
return Result.UNKNOWN;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ static class Builder {
private TestType testType = TestType.ALL;
private TestState testState;
private long runId = -1;
private DevModeContext devModeContext;
private CuratedApplication testApplication;
private ClassScanResult classScanResult;
private TestClassUsages testClassUsages;
Expand Down Expand Up @@ -783,11 +782,6 @@ public Builder setTestType(TestType testType) {
return this;
}

public Builder setDevModeContext(DevModeContext devModeContext) {
this.devModeContext = devModeContext;
return this;
}

public Builder setTestApplication(CuratedApplication testApplication) {
this.testApplication = testApplication;
return this;
Expand Down Expand Up @@ -849,7 +843,6 @@ public Builder setExcludeEngines(List<String> excludeEngines) {
}

public JunitTestRunner build() {
Objects.requireNonNull(devModeContext, "devModeContext");
Objects.requireNonNull(testClassUsages, "testClassUsages");
Objects.requireNonNull(testApplication, "testApplication");
Objects.requireNonNull(testState, "testState");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ public class ModuleTestRunner {

final TestState testState = new TestState();
private final TestSupport testSupport;
private final DevModeContext devModeContext;
private final CuratedApplication testApplication;
private final DevModeContext.ModuleInfo moduleInfo;

private final TestClassUsages testClassUsages = new TestClassUsages();
private JunitTestRunner runner;

public ModuleTestRunner(TestSupport testSupport, DevModeContext devModeContext, CuratedApplication testApplication,
public ModuleTestRunner(TestSupport testSupport, CuratedApplication testApplication,
DevModeContext.ModuleInfo moduleInfo) {
this.testSupport = testSupport;
this.devModeContext = devModeContext;
this.testApplication = testApplication;
this.moduleInfo = moduleInfo;
}
Expand All @@ -50,7 +48,6 @@ Runnable prepare(ClassScanResult classScanResult, boolean reRunFailures, long ru
}
JunitTestRunner.Builder builder = new JunitTestRunner.Builder()
.setClassScanResult(classScanResult)
.setDevModeContext(devModeContext)
.setRunId(runId)
.setTestState(testState)
.setTestClassUsages(testClassUsages)
Expand Down
Loading

0 comments on commit 6e95bcf

Please sign in to comment.