-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RuntimeConfigDefault changes ignored on restart
Also makes sure datasources restart if devservices properties are changed. Fixes #17069
- Loading branch information
1 parent
701fd3e
commit fc835af
Showing
7 changed files
with
178 additions
and
42 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
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
53 changes: 53 additions & 0 deletions
53
...io/quarkus/jdbc/postgresql/deployment/DevServicesPostgresqlDatasourceDevModeTestCase.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,53 @@ | ||
package io.quarkus.jdbc.postgresql.deployment; | ||
|
||
import java.util.logging.Level; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.agroal.api.AgroalDataSource; | ||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class DevServicesPostgresqlDatasourceDevModeTestCase { | ||
|
||
@RegisterExtension | ||
static QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(PgResource.class) | ||
.addAsResource(new StringAsset(""), "application.properties")) | ||
// Expect no warnings (in particular from Agroal) | ||
.setLogRecordPredicate(record -> record.getLevel().intValue() >= Level.WARNING.intValue() | ||
// There are other warnings: JDK8, TestContainers, drivers, ... | ||
// Ignore them: we're only interested in Agroal here. | ||
&& record.getMessage().contains("Agroal")); | ||
|
||
@Inject | ||
AgroalDataSource dataSource; | ||
|
||
@Test | ||
public void testDatasource() throws Exception { | ||
RestAssured.get("/pg/save?name=foo&value=bar") | ||
.then().statusCode(204); | ||
|
||
RestAssured.get("/pg/get?name=foo") | ||
.then().statusCode(200) | ||
.body(Matchers.equalTo("bar")); | ||
|
||
test.modifyResourceFile("application.properties", s -> "quarkus.datasource.devservices.properties.log=TRACE"); | ||
|
||
RestAssured.get("/pg/get?name=foo") | ||
.then().statusCode(404); | ||
RestAssured.get("/pg/save?name=foo&value=bar") | ||
.then().statusCode(204); | ||
RestAssured.get("/pg/get?name=foo") | ||
.then().statusCode(200) | ||
.body(Matchers.equalTo("bar")); | ||
} | ||
} |
Oops, something went wrong.