Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade SmallRye Health to 3.3.0 #27829

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<microprofile-lra.version>1.0</microprofile-lra.version>
<smallrye-common.version>1.13.1</smallrye-common.version>
<smallrye-config.version>2.12.0</smallrye-config.version>
<smallrye-health.version>3.2.1</smallrye-health.version>
<smallrye-health.version>3.3.0</smallrye-health.version>
<smallrye-metrics.version>3.0.5</smallrye-metrics.version>
<smallrye-open-api.version>2.2.1</smallrye-open-api.version>
<smallrye-graphql.version>1.7.1</smallrye-graphql.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.quarkus.smallrye.health.deployment;

import java.util.OptionalInt;

import io.quarkus.runtime.annotations.ConfigDocSection;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;
Expand Down Expand Up @@ -55,6 +57,12 @@ public class SmallRyeHealthConfig {
@ConfigItem(defaultValue = "false")
boolean contextPropagation;

/**
* The number of the maximum health groups that can be created.
*/
@ConfigItem
OptionalInt maxGroupRegistriesCount;

/**
* SmallRye Health UI configuration
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,12 @@ public void defineHealthRoutes(BuildProducer<RouteBuildItem> routes,
.build());

SmallRyeIndividualHealthGroupHandler handler = new SmallRyeIndividualHealthGroupHandler();
for (String healthGroup : healthGroups) {
routes.produce(nonApplicationRootPathBuildItem.routeBuilder()
.nestedRoute(healthConfig.rootPath, healthConfig.groupPath + "/" + healthGroup)
.handler(handler)
.displayOnNotFoundPage()
.blockingRoute()
.build());
}
routes.produce(nonApplicationRootPathBuildItem.routeBuilder()
.nestedRoute(healthConfig.rootPath, healthConfig.groupPath + "/*")
.handler(handler)
.displayOnNotFoundPage()
.blockingRoute()
.build());

// Register the wellness handler
routes.produce(nonApplicationRootPathBuildItem.routeBuilder()
Expand All @@ -275,6 +273,10 @@ public void processSmallRyeHealthConfigValues(SmallRyeHealthConfig healthConfig,
if (healthConfig.contextPropagation) {
config.produce(new RunTimeConfigurationDefaultBuildItem("io.smallrye.health.context.propagation", "true"));
}
if (healthConfig.maxGroupRegistriesCount.isPresent()) {
config.produce(new RunTimeConfigurationDefaultBuildItem("io.smallrye.health.maxGroupRegistriesCount",
String.valueOf(healthConfig.maxGroupRegistriesCount.getAsInt())));
}
config.produce(new RunTimeConfigurationDefaultBuildItem("io.smallrye.health.delayChecksInitializations", "true"));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.quarkus.smallrye.health.test;

import static org.hamcrest.Matchers.is;

import org.hamcrest.Matchers;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;
import io.restassured.RestAssured;
import io.restassured.parsing.Parser;

public class MaxHealthGroupTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(BasicHealthCheck.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"))
.overrideConfigKey("quarkus.smallrye-health.max-group-registries-count", "3");

@Test
public void testMaxGroupRegistriesCreations() {
try {
RestAssured.defaultParser = Parser.JSON;

for (int i = 0; i < 3; i++) {
RestAssured.get("/q/health/group/" + i).then()
.statusCode(200)
.body("status", is("UP"),
"checks.size()", is(0));
}
RestAssured.when().get("/q/health/group/not-allowed").then()
.statusCode(500)
.body("details", Matchers.endsWith("3"));
} finally {
RestAssured.reset();
}
}

}
2 changes: 1 addition & 1 deletion jakarta/rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ recipeList:
newValue: 2.0.0.RC8
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-health.version
newValue: 4.0.0-RC2
newValue: 4.0.0
- org.openrewrite.maven.ChangePropertyValue:
key: microprofile-jwt.version
newValue: 2.0
Expand Down