forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#13375 from jmartisk/master-issue-13326
Ability to exclude particular data sources from the health check
- Loading branch information
Showing
10 changed files
with
133 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...l/deployment/src/test/java/io/quarkus/agroal/test/DataSourceHealthCheckExclusionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.quarkus.agroal.test; | ||
|
||
import org.hamcrest.CoreMatchers; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class DataSourceHealthCheckExclusionTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)) | ||
.withConfigurationResource("application-datasources-with-health.properties"); | ||
|
||
@Test | ||
public void testDataSourceHealthCheckExclusion() { | ||
RestAssured.when().get("/health/ready") | ||
.then() | ||
.body("status", CoreMatchers.equalTo("UP")); | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...sions/agroal/deployment/src/test/resources/application-datasources-with-health.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
quarkus.datasource.db-kind=h2 | ||
quarkus.datasource.username=username-default | ||
quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:default | ||
quarkus.datasource.jdbc.max-size=13 | ||
|
||
# this data source is broken, but will be excluded from the health check, so the overall check should pass | ||
quarkus.datasource.brokenDS.db-kind=h2 | ||
quarkus.datasource.brokenDS.username=username1 | ||
quarkus.datasource.brokenDS.jdbc.driver=org.h2.Driver | ||
quarkus.datasource.brokenDS.jdbc.url=BROKEN | ||
quarkus.datasource.brokenDS.health-exclude=true | ||
|
||
quarkus.datasource.health.enabled=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...time/src/main/java/io/quarkus/datasource/runtime/DataSourcesExcludedFromHealthChecks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.quarkus.datasource.runtime; | ||
|
||
import java.util.List; | ||
|
||
public class DataSourcesExcludedFromHealthChecks { | ||
|
||
private List<String> excludedNames; | ||
|
||
public DataSourcesExcludedFromHealthChecks(List<String> names) { | ||
this.excludedNames = names; | ||
} | ||
|
||
public List<String> getExcludedNames() { | ||
return excludedNames; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters