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.1 (4.0.1) #29537

Merged
merged 1 commit into from
Nov 29, 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.2</smallrye-common.version>
<smallrye-config.version>2.13.0</smallrye-config.version>
<smallrye-health.version>3.3.0</smallrye-health.version>
<smallrye-health.version>3.3.1</smallrye-health.version>
<smallrye-metrics.version>3.0.5</smallrye-metrics.version>
<smallrye-open-api.version>2.3.1</smallrye-open-api.version>
<smallrye-graphql.version>1.9.0</smallrye-graphql.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.smallrye.health.deployment;

import java.util.Optional;
import java.util.OptionalInt;

import io.quarkus.runtime.annotations.ConfigDocSection;
Expand Down Expand Up @@ -63,6 +64,12 @@ public class SmallRyeHealthConfig {
@ConfigItem
OptionalInt maxGroupRegistriesCount;

/**
* The name of the default health group used when no other health group is defined on the health check.
*/
@ConfigItem
Optional<String> defaultHealthGroup;

/**
* SmallRye Health UI configuration
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ public void processSmallRyeHealthConfigValues(SmallRyeHealthConfig healthConfig,
String.valueOf(healthConfig.maxGroupRegistriesCount.getAsInt())));
}
config.produce(new RunTimeConfigurationDefaultBuildItem("io.smallrye.health.delayChecksInitializations", "true"));
if (healthConfig.defaultHealthGroup.isPresent()) {
config.produce(new RunTimeConfigurationDefaultBuildItem("io.smallrye.health.defaultHealthGroup",
healthConfig.defaultHealthGroup.get()));
}
}

@BuildStep(onlyIf = OpenAPIIncluded.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package io.quarkus.smallrye.health.test;

import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;

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

import io.quarkus.smallrye.health.test.ui.HealthGroupCheck;
import io.quarkus.test.QuarkusUnitTest;
import io.restassured.RestAssured;
import io.restassured.parsing.Parser;

public class DefaultHealthGroupTest {

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

@Test
public void testDefaultHealthGroup() {
try {
RestAssured.defaultParser = Parser.JSON;
RestAssured.when().get("/q/health/group/my-default-health-group").then()
.body("status", is("UP"),
"checks.size()", is(1),
"checks.status", contains("UP"),
"checks.name", contains("basic"));

RestAssured.when().get("/q/health/group/test-group").then()
.body("status", is("UP"),
"checks.size()", is(1),
"checks.status", contains("UP"),
"checks.name", contains(HealthGroupCheck.class.getName()));

RestAssured.when().get("/q/health/group").then()
.body("status", is("UP"),
"checks.size()", is(2),
"checks.status", hasItems("UP", "UP"),
"checks.name", hasItems("basic", HealthGroupCheck.class.getName()));
} finally {
RestAssured.reset();
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.quarkus.smallrye.health.test.ui;

import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;

import io.smallrye.health.api.HealthGroup;

@HealthGroup("test-group")
public class HealthGroupCheck implements HealthCheck {
@Override
public HealthCheckResponse call() {
return HealthCheckResponse.up(HealthGroupCheck.class.getName());
}
}
2 changes: 1 addition & 1 deletion jakarta/rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ recipeList:
newValue: '2.0.0'
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-health.version
newValue: '4.0.0'
newValue: '4.0.1'
- org.openrewrite.maven.ChangePropertyValue:
key: microprofile-jwt.version
newValue: '2.0'
Expand Down