Skip to content

Commit

Permalink
pin tests to min server versions
Browse files Browse the repository at this point in the history
  • Loading branch information
evanchooly committed Feb 17, 2024
1 parent 247f028 commit 81e80f8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 20 deletions.
5 changes: 2 additions & 3 deletions audits/src/main/kotlin/dev/morphia/audits/model/CodeBlock.kt
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,12 @@ class CodeBlock {
.filter { it.isNotBlank() }
.joinToString("\n")

if (sanitized.endsWith(";")) sanitized = sanitized.dropLast(1).trim()
if (sanitized.contains(".aggregate"))
sanitized = sanitized.substringAfter(".aggregate").trim()
if (sanitized.startsWith("(")) {
sanitized = sanitized.drop(1).trim()
if (sanitized.endsWith(")")) {
sanitized = sanitized.dropLast(1).trim()
}
if (sanitized.endsWith(")")) sanitized = sanitized.dropLast(1).trim()
}
if (sanitized.startsWith("[")) sanitized = sanitized.drop(1).dropLast(1).trim()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AggregationAuditTest {

@Test
fun testOperator() {
val name = "dateDiff"
val name = "geoNear"
var operator = Operator(File("${aggRoot}/$name.txt"))
operator.examples.forEach { it.output(File("target/testOperator-${name}/${it.name}")) }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.morphia.test.aggregation.expressions;

import dev.morphia.test.ServerVersion;
import dev.morphia.test.aggregation.AggregationTest;

import org.testng.annotations.Test;
Expand Down Expand Up @@ -28,7 +27,7 @@ public void testExample1() {

@Test
public void testExample2() {
testPipeline(ServerVersion.ANY, false, false, (aggregation) -> aggregation.pipeline(
testPipeline(v52, false, false, (aggregation) -> aggregation.pipeline(
group(id("$gameId"))
.field("playerId",
bottom(array("$playerId", "$score"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testExample2() {

@Test
public void testExample3() {
testPipeline(ServerVersion.ANY, true, true, (aggregation) -> aggregation.pipeline(
testPipeline(ServerVersion.v60, true, true, (aggregation) -> aggregation.pipeline(
lookup(AGG_TEST_COLLECTION)
.as("joinedField")
.let("pt", "$location")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{ "_id": 1, name: "Central Park", location: { type: "Point", coordinates: [ -73.97, 40.77 ] }, category: "Parks" },
{ "_id": 2, name: "Sara D. Roosevelt Park", location: { type: "Point", coordinates: [ -73.9928, 40.7193 ] }, category: "Parks" },
{ "_id": 3, name: "Polo Grounds", location: { type: "Point", coordinates: [ -73.9375, 40.8303 ] }, category: "Stadiums" }
{ name: "Central Park", location: { type: "Point", coordinates: [ -73.97, 40.77 ] }, category: "Parks" },
{ name: "Sara D. Roosevelt Park", location: { type: "Point", coordinates: [ -73.9928, 40.7193 ] }, category: "Parks" },
{ name: "Polo Grounds", location: { type: "Point", coordinates: [ -73.9375, 40.8303 ] }, category: "Stadiums" }
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ _id: 2, name: 'Sara D. Roosevelt Park', location: { type: 'Point', coordinates: [ -73.9928, 40.7193 ] }, category: 'Parks', joinedField: [ { _id: 2, name: 'Sara D. Roosevelt Park', location: { type: 'Point', coordinates: [ -73.9928, 40.7193 ] }, category: 'Parks', distance: 0 }, { _id: 1, name: 'Central Park', location: { type: 'Point', coordinates: [ -73.97, 40.77 ] }, category: 'Parks', distance: 5962.448255235006 }, { _id: 3, name: 'Polo Grounds', location: { type: 'Point', coordinates: [ -73.9375, 40.8303 ] }, category: 'Stadiums', distance: 13206.535424939102 } ]}
{ _id: ObjectId("61715cf9b0c1d171bb498fd7"), name: 'Sara D. Roosevelt Park', location: { type: 'Point', coordinates: [ -73.9928, 40.7193 ] }, category: 'Parks', joinedField: [ { _id: ObjectId("61715cf9b0c1d171bb498fd7"), name: 'Sara D. Roosevelt Park', location: { type: 'Point', coordinates: [ -73.9928, 40.7193 ] }, category: 'Parks', distance: 0 }, { _id: ObjectId("61715cf9b0c1d171bb498fd6"), name: 'Central Park', location: { type: 'Point', coordinates: [ -73.97, 40.77 ] }, category: 'Parks', distance: 5962.448255234964 }, { _id: ObjectId("61715cfab0c1d171bb498fd8"), name: 'Polo Grounds', location: { type: 'Point', coordinates: [ -73.9375, 40.8303 ] }, category: 'Stadiums', distance: 13206.535424939102 } ]}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[
{
{
$lookup: {
from: "aggtest",
as: "joinedField",
from: "places",
let: { pt: "$location" },
pipeline: [
{
Expand All @@ -11,10 +9,10 @@
distanceField: "distance"
}
}
]
],
as: "joinedField"
}
},
{
$match: { name: "Sara D. Roosevelt Park" }
}
]
}

0 comments on commit 81e80f8

Please sign in to comment.