-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check that MongoDB Dev Services are not started when either `quarkus.mongodb.connection-string` or `quarkus.mongodb.hosts` are present. To prevent regressions, this integration test ensures that Dev Services are actually started (by checking the appropriate properties) for the default client.
- Loading branch information
1 parent
8f11bb6
commit 624d6ad
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
integration-tests/mongodb-devservices/src/main/resources/application.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 |
---|---|---|
@@ -1 +1,5 @@ | ||
quarkus.mongodb.parameter-injection.write-concern.journal=true | ||
|
||
quarkus.mongodb.with-connection-string.connection-string=mongodb://localhost:27017 | ||
|
||
quarkus.mongodb.with-hosts.hosts=localhost:27017 |
48 changes: 48 additions & 0 deletions
48
...n-tests/mongodb-devservices/src/test/java/io/quarkus/it/mongodb/DevServicesStartTest.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,48 @@ | ||
package io.quarkus.it.mongodb; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.hasKey; | ||
import static org.hamcrest.Matchers.not; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
import com.mongodb.client.MongoClient; | ||
|
||
import io.quarkus.mongodb.MongoClientName; | ||
import io.quarkus.test.common.DevServicesContext; | ||
import io.quarkus.test.common.QuarkusTestResource; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.mongodb.MongoTestResource; | ||
|
||
@QuarkusTest | ||
@QuarkusTestResource(value = MongoTestResource.class) | ||
public class DevServicesStartTest { | ||
|
||
DevServicesContext context; | ||
|
||
@Inject | ||
@MongoClientName("with-connection-string") | ||
MongoClient clientWithConnectionString; | ||
|
||
@Inject | ||
@MongoClientName("with-hosts") | ||
MongoClient clientWithHosts; | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = { | ||
"quarkus.mongodb.with-connection-string.connection-string", | ||
"quarkus.mongodb.with-hosts.connection-string" | ||
}) | ||
public void testDevServicesNotStarted(String property) { | ||
assertThat(context.devServicesProperties(), not(hasKey(property))); | ||
} | ||
|
||
@Test | ||
public void testDevServicesStarted() { | ||
assertThat(context.devServicesProperties(), hasKey("quarkus.mongodb.connection-string")); | ||
} | ||
} |