Skip to content

Commit

Permalink
Merge pull request #26590 from evanchooly/mongoNoWindows
Browse files Browse the repository at this point in the history
Fix flaky mongo devservices on windows
  • Loading branch information
evanchooly authored Jul 19, 2022
2 parents d5b6090 + 2ab678f commit d7ec3d6
Show file tree
Hide file tree
Showing 23 changed files with 722 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/native-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{
"category": "Data4",
"timeout": 55,
"test-modules": "mongodb-client, mongodb-panache, mongodb-rest-data-panache, mongodb-panache-kotlin, redis-client, hibernate-orm-rest-data-panache",
"test-modules": "mongodb-client, mongodb-devservices, mongodb-panache, mongodb-rest-data-panache, mongodb-panache-kotlin, redis-client, hibernate-orm-rest-data-panache",
"os-name": "ubuntu-latest"
},
{
Expand Down
1 change: 0 additions & 1 deletion extensions/mongodb-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,4 @@
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.quarkus.test.QuarkusUnitTest;

public class NamedMongoClientConfigTest extends MongoWithReplicasTestBase {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar.addClasses(MongoTestBase.class))
Expand Down
2 changes: 0 additions & 2 deletions extensions/mongodb-client/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,4 @@
</plugin>
</plugins>
</build>


</project>
2 changes: 0 additions & 2 deletions integration-tests/liquibase-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,4 @@
</plugin>
</plugins>
</build>


</project>
28 changes: 0 additions & 28 deletions integration-tests/mongodb-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,32 +113,4 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>no-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,10 @@ public class BookResource {
@MongoClientName("parameter-injection")
MongoClient client;

@Inject
@MongoClientName("dev-services")
MongoClient devServiced;
@Inject
@MongoClientName("dev-services2")
MongoClient devServiced2;

private MongoCollection<Book> getCollection() {
return client.getDatabase("books").getCollection("my-collection", Book.class);
}

private MongoCollection<Book> getServicedCollection() {
return devServiced.getDatabase("books").getCollection("my-collection", Book.class);
}

private MongoCollection<Book> getServiced2Collection() {
return devServiced.getDatabase("books").getCollection("my-collection", Book.class);
}

@GET
public List<Book> getBooks() {
FindIterable<Book> iterable = getCollection().find();
Expand All @@ -61,16 +46,12 @@ public List<Book> getBooks() {
@POST
public Response addBook(Book book) {
getCollection().insertOne(book);
getServicedCollection().insertOne(book);
getServiced2Collection().insertOne(book);
return Response.accepted().build();
}

@GET
@Path("/{author}")
public List<Book> getBooksByAuthor(@PathParam("author") String author) {
getServicedCollection().find(eq("author", author));
getServiced2Collection().find(eq("author", author));
FindIterable<Book> iterable = getCollection().find(eq("author", author));
List<Book> books = new ArrayList<>();
for (Book doc : iterable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ quarkus.mongodb.connection-string=mongodb://localhost:27017
quarkus.mongodb.write-concern.journal=false
quarkus.mongodb.parameter-injection.connection-string=mongodb://localhost:27017
quarkus.mongodb.parameter-injection.write-concern.journal=true

quarkus.mongodb.dev-services.write-concern.journal=false
quarkus.mongodb.dev-services2.write-concern.journal=false
144 changes: 144 additions & 0 deletions integration-tests/mongodb-devservices/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-integration-tests-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>

<artifactId>quarkus-integration-test-mongodb-devservices</artifactId>

<name>Quarkus - Integration Tests - MongoDB DevServices</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mongodb-client</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-mongodb</artifactId>
<scope>test</scope>
</dependency>

<!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mongodb-client-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jsonb-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>no-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.quarkus.it.mongodb;

import java.util.ArrayList;
import java.util.List;

import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection
public class Book {

private String id;

private String title;
private String author;

private List<String> categories = new ArrayList<>();

private BookDetail details;

public String getTitle() {
return title;
}

public Book setTitle(String title) {
this.title = title;
return this;
}

public String getId() {
return id;
}

public Book setId(String id) {
this.id = id;
return this;
}

public String getAuthor() {
return author;
}

public Book setAuthor(String author) {
this.author = author;
return this;
}

public List<String> getCategories() {
return categories;
}

public Book setCategories(List<String> categories) {
this.categories = categories;
return this;
}

public BookDetail getDetails() {
return details;
}

public Book setDetails(BookDetail details) {
this.details = details;
return this;
}
}
Loading

0 comments on commit d7ec3d6

Please sign in to comment.