Skip to content

Commit

Permalink
Merge pull request #96 from opencb/TASK-4974
Browse files Browse the repository at this point in the history
TASK-4974 - Junit test MongoDBCollectionTest.testAggregate fails randomly
  • Loading branch information
jtarraga authored Oct 11, 2024
2 parents 878949e + c6a60ff commit 9dfa2c5
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,13 @@ public void testAggregate() {

queryResult = mongoDBCollection.aggregate(dbObjectList, new QueryOptions(QueryOptions.LIMIT, 1).append(QueryOptions.SKIP, 0));
assertEquals("There must be 1 results", 1, queryResult.getResults().size());
assertTrue(queryResult.getResults().contains(result.get(0)));
// As the order of result list change between executions, we must ensure the assertTrue doesn't depend on the order
assertTrue(result.contains(queryResult.getResults().get(0)));

queryResult = mongoDBCollection.aggregate(dbObjectList, new QueryOptions(QueryOptions.LIMIT, 1).append(QueryOptions.SKIP, 1));
assertEquals("There must be 1 results", 1, queryResult.getResults().size());

System.out.println("result = " + result);
System.out.println("queryResult.getResults() = " + queryResult.getResults());

assertTrue(queryResult.getResults().contains(result.get(1)));
// As the order of result list change between executions, we must ensure the assertTrue doesn't depend on the order
assertTrue(result.contains(queryResult.getResults().get(0)));
}

@Test
Expand Down

0 comments on commit 9dfa2c5

Please sign in to comment.