Skip to content

Commit

Permalink
Fix SmallRye Health configuration conversion
Browse files Browse the repository at this point in the history
The SmallRye Health extension needs to take the Quarkus configuration
(`quarkus.smallrye-health.*`) and convert some of it to SmallRye Health
specific configuration properties (`io.smallrye.health.*`). To do that,
the extension used to produce a `SystemPropertyBuildItem`, which results
in changing JVM-global system properties. This may negatively affect
`QuarkusUnitTest` tests, because even though each runs their own Quarkus
application, they all share the same JVM.

With this commit, the extension instead uses `RunTimeConfigurationDefaultBuildItem`,
which is properly scoped per application and doesn't affect JVM-global state.
  • Loading branch information
Ladicek committed Sep 1, 2022
1 parent 7859959 commit ecd051c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.builditem.ShutdownListenerBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.kubernetes.spi.KubernetesHealthLivenessPathBuildItem;
import io.quarkus.kubernetes.spi.KubernetesHealthReadinessPathBuildItem;
Expand Down Expand Up @@ -271,11 +271,11 @@ public void defineHealthRoutes(BuildProducer<RouteBuildItem> routes,

@BuildStep
public void processSmallRyeHealthConfigValues(SmallRyeHealthConfig healthConfig,
BuildProducer<SystemPropertyBuildItem> systemProperties) {
BuildProducer<RunTimeConfigurationDefaultBuildItem> config) {
if (healthConfig.contextPropagation) {
systemProperties.produce(new SystemPropertyBuildItem("io.smallrye.health.context.propagation", "true"));
config.produce(new RunTimeConfigurationDefaultBuildItem("io.smallrye.health.context.propagation", "true"));
}
systemProperties.produce(new SystemPropertyBuildItem("io.smallrye.health.delayChecksInitializations", "true"));
config.produce(new RunTimeConfigurationDefaultBuildItem("io.smallrye.health.delayChecksInitializations", "true"));
}

@BuildStep(onlyIf = OpenAPIIncluded.class)
Expand Down

0 comments on commit ecd051c

Please sign in to comment.