forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
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#45330 from danilopiazza/mongodb-devservi…
…ces-disable-when-hosts-is-present Disable MongoDB Dev Services when the hosts property is provided
- Loading branch information
Showing
4 changed files
with
57 additions
and
5 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
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")); | ||
} | ||
} |