diff --git a/integration/aggregate_documents_compat_test.go b/integration/aggregate_documents_compat_test.go index 222f97c8b0d7..a3c57dd6fda7 100644 --- a/integration/aggregate_documents_compat_test.go +++ b/integration/aggregate_documents_compat_test.go @@ -29,7 +29,6 @@ import ( "github.com/FerretDB/FerretDB/integration/setup" "github.com/FerretDB/FerretDB/integration/shareddata" - "github.com/FerretDB/FerretDB/internal/util/testutil/testtb" ) // aggregateStagesCompatTestCase describes aggregation stages compatibility test case. @@ -40,7 +39,6 @@ type aggregateStagesCompatTestCase struct { resultType compatTestCaseResultType // defaults to nonEmptyResult resultPushdown bool // defaults to false skip string // skip test for all handlers, must have issue number mentioned - failsForSQLite string // optional, if set, the case is expected to fail for SQLite due to given issue } // testAggregateStagesCompat tests aggregation stages compatibility test cases with all providers. @@ -106,10 +104,7 @@ func testAggregateStagesCompatWithProviders(tt *testing.T, providers shareddata. tt.Run(targetCollection.Name(), func(tt *testing.T) { tt.Helper() - var t testtb.TB = tt - if tc.failsForSQLite != "" { - t = setup.FailsForSQLite(tt, tc.failsForSQLite) - } + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3148") explainCommand := bson.D{{"explain", bson.D{ {"aggregate", targetCollection.Name()}, @@ -158,7 +153,8 @@ func testAggregateStagesCompatWithProviders(tt *testing.T, providers shareddata. }) } - if tc.failsForSQLite != "" && setup.IsSQLite(tt) { + // TODO https://github.com/FerretDB/FerretDB/issues/3148 + if setup.IsSQLite(tt) { return } @@ -179,8 +175,7 @@ type aggregateCommandCompatTestCase struct { command bson.D // required resultType compatTestCaseResultType // defaults to nonEmptyResult - skip string // skip test for all handlers, must have issue number mentioned - failsForSQLite string // optional, if set, the case is expected to fail for SQLite due to given issue + skip string // skip test for all handlers, must have issue number mentioned } // testAggregateCommandCompat tests aggregate pipeline compatibility test cases using one collection. @@ -216,10 +211,7 @@ func testAggregateCommandCompat(tt *testing.T, testCases map[string]aggregateCom tt.Run(targetCollection.Name(), func(tt *testing.T) { tt.Helper() - var t testtb.TB = tt - if tc.failsForSQLite != "" { - t = setup.FailsForSQLite(tt, tc.failsForSQLite) - } + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3148") var targetRes, compatRes bson.D targetErr := targetCollection.Database().RunCommand(ctx, command).Decode(&targetRes) @@ -247,7 +239,8 @@ func testAggregateCommandCompat(tt *testing.T, testCases map[string]aggregateCom } }) - if tc.failsForSQLite != "" && setup.IsSQLite(tt) { + // TODO https://github.com/FerretDB/FerretDB/issues/3148 + if setup.IsSQLite(tt) { return } @@ -277,32 +270,28 @@ func TestAggregateCommandCompat(t *testing.T) { command: bson.D{ {"aggregate", 2}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "PipelineTypeMismatch": { command: bson.D{ {"aggregate", "collection-name"}, {"pipeline", 1}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "StageTypeMismatch": { command: bson.D{ {"aggregate", "collection-name"}, {"pipeline", bson.A{1}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidStage": { command: bson.D{ {"aggregate", "collection-name"}, {"pipeline", bson.A{"$invalid-stage"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "MaxTimeMSDoubleWholeNumber": { command: bson.D{ @@ -311,7 +300,6 @@ func TestAggregateCommandCompat(t *testing.T) { {"cursor", bson.D{}}, {"maxTimeMS", float64(1000)}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -328,14 +316,12 @@ func TestAggregateCompatOptions(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "MaxTimeZero": { - pipeline: bson.A{}, - maxTime: pointer.ToDuration(time.Duration(0)), - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{}, + maxTime: pointer.ToDuration(time.Duration(0)), }, "MaxTime": { - pipeline: bson.A{}, - maxTime: pointer.ToDuration(time.Second), - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{}, + maxTime: pointer.ToDuration(time.Second), }, } @@ -354,7 +340,6 @@ func TestAggregateCompatStages(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, resultPushdown: true, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountAndMatch": { pipeline: bson.A{ @@ -363,7 +348,6 @@ func TestAggregateCompatStages(t *testing.T) { bson.D{{"$match", bson.D{{"v", 1}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -381,8 +365,7 @@ func TestAggregateCompatEmptyPipeline(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "Empty": { - pipeline: bson.A{}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{}, }, } @@ -394,37 +377,30 @@ func TestAggregateCompatCount(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "Value": { - pipeline: bson.A{bson.D{{"$count", "v"}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$count", "v"}}}, }, "NonExistent": { - pipeline: bson.A{bson.D{{"$count", "nonexistent"}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$count", "nonexistent"}}}, }, "CountGroupID": { - pipeline: bson.A{bson.D{{"$count", "_id"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$count", "_id"}}}, + resultType: emptyResult, }, "CountNonString": { - pipeline: bson.A{bson.D{{"$count", 1}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$count", 1}}}, + resultType: emptyResult, }, "CountEmpty": { - pipeline: bson.A{bson.D{{"$count", ""}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$count", ""}}}, + resultType: emptyResult, }, "CountBadValue": { - pipeline: bson.A{bson.D{{"$count", "v.foo"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$count", "v.foo"}}}, + resultType: emptyResult, }, "CountBadPrefix": { - pipeline: bson.A{bson.D{{"$count", "$foo"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$count", "$foo"}}}, + resultType: emptyResult, }, } @@ -455,7 +431,6 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Distinct": { pipeline: bson.A{ @@ -484,7 +459,6 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "LimitAfter": { @@ -497,7 +471,6 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 5}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "LimitBefore": { pipeline: bson.A{ @@ -509,7 +482,6 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SkipAfter": { pipeline: bson.A{ @@ -521,7 +493,6 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", 2}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SkipBefore": { pipeline: bson.A{ @@ -533,7 +504,6 @@ func TestAggregateCompatGroupDeterministicCollections(t *testing.T) { // sort descending order, so ArrayDoubles has deterministic order. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -548,13 +518,11 @@ func TestAggregateCompatGroup(t *testing.T) { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DistinctID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$_id"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDExpression": { pipeline: bson.A{ @@ -564,7 +532,6 @@ func TestAggregateCompatGroup(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDExpressionNested": { pipeline: bson.A{ @@ -677,61 +644,52 @@ func TestAggregateCompatGroup(t *testing.T) { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$invalid"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExpressionID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "v"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonStringID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", bson.A{}}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "OperatorNameAsExpression": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$add"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyPath": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$"}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "EmptyVariable": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$"}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidVariable$": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$$"}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidVariable$s": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$$s"}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "NonExistingVariable": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$$s"}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/2275", + resultType: emptyResult, + skip: "https://github.com/FerretDB/FerretDB/issues/2275", }, "SystemVariable": { pipeline: bson.A{bson.D{{"$group", bson.D{ @@ -741,45 +699,39 @@ func TestAggregateCompatGroup(t *testing.T) { skip: "https://github.com/FerretDB/FerretDB/issues/2275", }, "GroupInvalidFields": { - pipeline: bson.A{bson.D{{"$group", 1}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$group", 1}}}, + resultType: emptyResult, }, "EmptyGroup": { - pipeline: bson.A{bson.D{{"$group", bson.D{}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$group", bson.D{}}}}, + resultType: emptyResult, }, "MissingID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"bla", 1}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"v", 1}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "EmptyAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"v", bson.D{}}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "GroupMultipleAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"v", bson.D{{"$count", "v"}, {"$count", "v"}}}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "GroupInvalidAccumulator": { pipeline: bson.A{bson.D{{"$group", bson.D{ @@ -794,7 +746,6 @@ func TestAggregateCompatGroup(t *testing.T) { {"_id", bson.D{{"$type", "$v"}}}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDSum": { pipeline: bson.A{ @@ -802,7 +753,6 @@ func TestAggregateCompatGroup(t *testing.T) { bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", "$v"}}}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDFieldSum": { pipeline: bson.A{ @@ -824,21 +774,18 @@ func TestAggregateCompatGroup(t *testing.T) { bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", "$non-existent"}}}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDSumInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", "$"}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "IDSumRecursiveInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"_id", bson.D{{"$sum", bson.D{{"$sum", "$"}}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, } @@ -863,37 +810,26 @@ func TestAggregateCompatGroupExpressionDottedFields(t *testing.T) { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.foo"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DeeplyNested": { // Expect non-empty results for DocumentsDeeplyNested provider pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.a.b.c"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayIndex": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.0"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NestedInArray": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.0.foo"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - }, - "NonExistentParent": { - pipeline: bson.A{bson.D{{"$group", bson.D{ - {"_id", "$non.existent"}, - }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistentChild": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$v.non.existent"}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -934,37 +870,32 @@ func TestAggregateCompatGroupCount(t *testing.T) { {"_id", nil}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "CountID": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$_id"}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeMismatch": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"count", bson.D{{"$count", ""}}}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "NonEmptyExpression": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", nil}, {"count", bson.D{{"$count", bson.D{{"a", 1}}}}}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "NonExistentField": { pipeline: bson.A{bson.D{{"$group", bson.D{ {"_id", "$nonexistent"}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Duplicate": { pipeline: bson.A{bson.D{{"$group", bson.D{ @@ -972,8 +903,7 @@ func TestAggregateCompatGroupCount(t *testing.T) { {"count", bson.D{{"$count", bson.D{}}}}, {"count", bson.D{{"$count", bson.D{}}}}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, } @@ -989,92 +919,80 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 0}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "One": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 1}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Five": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 5}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "StringInt": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", "5"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Double": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 4.5}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "DoubleInt": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", 5.0}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", math.MaxInt64}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MinInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", math.MinInt64}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Negative": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", -1}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "NegativeDouble": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", -2.1}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Document": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", bson.D{}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Int64Overflow": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$limit", float64(1 << 86)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "AfterMatch": { pipeline: bson.A{ @@ -1083,7 +1001,6 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$limit", 1}}, }, resultPushdown: true, // $sort and $match are first two stages - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "BeforeMatch": { pipeline: bson.A{ @@ -1091,8 +1008,7 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$limit", 1}}, bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "NoSortAfterMatch": { pipeline: bson.A{ @@ -1100,14 +1016,12 @@ func TestAggregateCompatLimit(t *testing.T) { bson.D{{"$limit", 100}}, }, resultPushdown: true, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NoSortBeforeMatch": { pipeline: bson.A{ bson.D{{"$limit", 100}}, bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1144,7 +1058,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { // ascending sort for shareddata collections. bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "GroupByID": { pipeline: bson.A{ @@ -1155,7 +1068,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "GroupByValue": { pipeline: bson.A{ @@ -1166,7 +1078,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyString": { pipeline: bson.A{ @@ -1177,7 +1088,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExpression": { pipeline: bson.A{ @@ -1188,7 +1098,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistent": { pipeline: bson.A{ @@ -1199,7 +1108,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Document": { pipeline: bson.A{ @@ -1211,7 +1119,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Array": { pipeline: bson.A{ @@ -1222,8 +1129,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Int32": { pipeline: bson.A{ @@ -1234,7 +1140,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxInt32": { pipeline: bson.A{ @@ -1245,7 +1150,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NegativeInt32": { pipeline: bson.A{ @@ -1256,7 +1160,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int64": { pipeline: bson.A{ @@ -1267,18 +1170,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - }, - "MaxInt64": { - pipeline: bson.A{ - bson.D{{"$sort", bson.D{{"_id", 1}}}}, - bson.D{{"$group", bson.D{ - {"_id", "$v"}, - {"sum", bson.D{{"$sum", math.MaxInt64}}}, - }}}, - bson.D{{"$sort", bson.D{{"_id", -1}}}}, - }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Double": { pipeline: bson.A{ @@ -1289,7 +1180,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MaxDouble": { pipeline: bson.A{ @@ -1300,7 +1190,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Bool": { pipeline: bson.A{ @@ -1311,7 +1200,6 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Duplicate": { pipeline: bson.A{ @@ -1323,8 +1211,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "RecursiveOperator": { pipeline: bson.A{ @@ -1336,21 +1223,18 @@ func TestAggregateCompatGroupSum(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"sum", bson.D{{"$sum", bson.D{{"v", "$v"}}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "RecursiveArrayInvalid": { pipeline: bson.A{ bson.D{{"$group", bson.D{{"sum", bson.D{{"$sum", bson.D{{"$type", bson.A{"1", "2"}}}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "RecursiveOperatorNonExistent": { pipeline: bson.A{ @@ -1360,8 +1244,7 @@ func TestAggregateCompatGroupSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.D{{"$non-existent", "$v"}}}}}, }}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, } @@ -1378,56 +1261,46 @@ func TestAggregateCompatMatch(t *testing.T) { "ID": { pipeline: bson.A{bson.D{{"$match", bson.D{{"_id", "string"}}}}}, resultPushdown: true, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v", 42}}}}, }, resultPushdown: true, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "String": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, resultPushdown: true, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Document": { - pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"foo", int32(42)}}}}}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"foo", int32(42)}}}}}}}, }, "Array": { - pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.A{int32(42)}}}}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.A{int32(42)}}}}}}, }, "Regex": { - pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"$eq", primitive.Regex{Pattern: "foo", Options: "i"}}}}}}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$match", bson.D{{"v", bson.D{{"$eq", primitive.Regex{Pattern: "foo", Options: "i"}}}}}}}}, }, "Empty": { pipeline: bson.A{ bson.D{{"$match", bson.D{}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationDocument": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v.foo", int32(42)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationArray": { pipeline: bson.A{ bson.D{{"$match", bson.D{{"v.0", int32(42)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MatchBadValue": { - pipeline: bson.A{bson.D{{"$match", 1}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$match", 1}}}, + resultType: emptyResult, }, "SumValue": { pipeline: bson.A{ @@ -1445,40 +1318,34 @@ func TestAggregateCompatSort(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "AscendingID": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 1}}}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 1}}}}}, }, "DescendingID": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", -1}}}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", -1}}}}}, }, "AscendingValue": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DescendingValue": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", -1}, {"_id", 1}, // sort by _id when v is the same. }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "AscendingValueDescendingID": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", 1}, {"_id", -1}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DescendingValueDescendingID": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v", -1}, {"_id", -1}, }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationIndex": { @@ -1486,42 +1353,35 @@ func TestAggregateCompatSort(t *testing.T) { {"v.0", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationNonExistent": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"invalid.foo", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationMissingField": { pipeline: bson.A{bson.D{{"$sort", bson.D{ {"v..foo", 1}, }}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "SortBadExpression": { - pipeline: bson.A{bson.D{{"$sort", 1}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$sort", 1}}}, + resultType: emptyResult, }, "SortBadOrder": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 0}}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$sort", bson.D{{"_id", 0}}}}}, + resultType: emptyResult, }, "SortMissingKey": { - pipeline: bson.A{bson.D{{"$sort", bson.D{}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$sort", bson.D{}}}}, + resultType: emptyResult, }, "BadDollarStart": { - pipeline: bson.A{bson.D{{"$sort", bson.D{{"$v.foo", 1}}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$sort", bson.D{{"$v.foo", 1}}}}}, + resultType: emptyResult, }, } @@ -1541,7 +1401,6 @@ func TestAggregateCompatSortDotNotation(t *testing.T) { {"v.foo", 1}, {"_id", 1}, // sort by _id when v is the same. }}}}, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1557,116 +1416,97 @@ func TestAggregateCompatUnwind(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$non-existent"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Invalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "invalid"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "DotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.foo"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.non-existent"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "ArrayDotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.0"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "ArrayDotNotationKey": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$v.0.foo"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Null": { - pipeline: bson.A{bson.D{{"$unwind", nil}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", nil}}}, + resultType: emptyResult, }, "ID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unwind", "$_id"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "NameAsExpression": { - pipeline: bson.A{bson.D{{"$unwind", "$add"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", "$add"}}}, + resultType: emptyResult, }, "EmptyPath": { - pipeline: bson.A{bson.D{{"$unwind", "$"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", "$"}}}, + resultType: emptyResult, }, "EmptyVariable": { - pipeline: bson.A{bson.D{{"$unwind", "$$"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", "$$"}}}, + resultType: emptyResult, }, "InvalidVariable$": { - pipeline: bson.A{bson.D{{"$unwind", "$$$"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", "$$$"}}}, + resultType: emptyResult, }, "InvalidVariable$s": { - pipeline: bson.A{bson.D{{"$unwind", "$$$s"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", "$$$s"}}}, + resultType: emptyResult, }, "NonExistingVariable": { - pipeline: bson.A{bson.D{{"$unwind", "$$s"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", "$$s"}}}, + resultType: emptyResult, }, "SystemVariable": { - pipeline: bson.A{bson.D{{"$unwind", "$$NOW"}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", "$$NOW"}}}, + resultType: emptyResult, }, "Empty": { - pipeline: bson.A{bson.D{{"$unwind", ""}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", ""}}}, + resultType: emptyResult, }, "Number": { - pipeline: bson.A{bson.D{{"$unwind", 42}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", 42}}}, + resultType: emptyResult, }, "Array": { - pipeline: bson.A{bson.D{{"$unwind", bson.A{"$v"}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$unwind", bson.A{"$v"}}}}, + resultType: emptyResult, }, } @@ -1678,73 +1518,63 @@ func TestAggregateCompatSkip(t *testing.T) { testCases := map[string]aggregateStagesCompatTestCase{ "Document": { - pipeline: bson.A{bson.D{{"$skip", bson.D{}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$skip", bson.D{}}}}, + resultType: emptyResult, }, "Zero": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", int32(0)}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "One": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", int32(1)}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SkipAll": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", int32(1000)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "StringInt": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", "1"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "NegativeValue": { - pipeline: bson.A{bson.D{{"$skip", int32(-1)}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$skip", int32(-1)}}}, + resultType: emptyResult, }, "NegativeDouble": { - pipeline: bson.A{bson.D{{"$skip", -3.2}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + pipeline: bson.A{bson.D{{"$skip", -3.2}}}, + resultType: emptyResult, }, "MaxInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", math.MaxInt64}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "MinInt64": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", math.MinInt64}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Int64Overflow": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$skip", float64(1 << 86)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "AfterMatch": { pipeline: bson.A{ @@ -1753,7 +1583,6 @@ func TestAggregateCompatSkip(t *testing.T) { bson.D{{"$skip", int32(1)}}, }, resultPushdown: true, // $match after $sort can be pushed down - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "BeforeMatch": { pipeline: bson.A{ @@ -1761,7 +1590,6 @@ func TestAggregateCompatSkip(t *testing.T) { bson.D{{"$skip", int32(1)}}, bson.D{{"$match", bson.D{{"v", "foo"}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -1777,67 +1605,58 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", "invalid"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "ZeroOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", bson.D{}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "TwoOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", bson.D{{"$type", "foo"}, {"$sum", 1}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "DollarSignField": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"$v", 1}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Include1Field": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", int32(1)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Exclude1Field": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"v", int64(0)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", 1.42}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Fields": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", 1.24}, {"bar", true}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Exclude2Fields": { pipeline: bson.A{ @@ -1845,7 +1664,6 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$project", bson.D{{"foo", int32(0)}, {"bar", false}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include1FieldExclude1Field": { pipeline: bson.A{ @@ -1853,8 +1671,7 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$project", bson.D{{"foo", int32(0)}, {"bar", true}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Exclude1FieldInclude1Field": { pipeline: bson.A{ @@ -1862,71 +1679,61 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$project", bson.D{{"foo", int32(1)}, {"bar", false}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "IncludeFieldExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}, {"v", true}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ExcludeFieldIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"v", false}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ExcludeFieldExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}, {"v", false}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeFieldIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"v", true}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign1Field": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", primitive.NewObjectID()}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "AssignID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", primitive.Binary{Subtype: 0x80, Data: []byte{42, 0, 13}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign1FieldIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"foo", primitive.NewDateTimeFromTime(time.Unix(0, 0))}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign2FieldsIncludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", true}, {"foo", nil}, {"bar", "qux"}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Assign1FieldExcludeID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", false}, {"foo", primitive.Regex{Pattern: "^fo"}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationInclude": { pipeline: bson.A{ @@ -1935,7 +1742,6 @@ func TestAggregateCompatProject(t *testing.T) { {"v.foo", true}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationIncludeTwo": { pipeline: bson.A{ @@ -1945,7 +1751,6 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array", true}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationExclude": { pipeline: bson.A{ @@ -1954,7 +1759,6 @@ func TestAggregateCompatProject(t *testing.T) { {"v.foo", false}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationExcludeTwo": { pipeline: bson.A{ @@ -1964,7 +1768,6 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array", false}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationExcludeSecondLevel": { pipeline: bson.A{ @@ -1973,7 +1776,6 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array.42", false}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationIncludeExclude": { pipeline: bson.A{ @@ -1983,37 +1785,32 @@ func TestAggregateCompatProject(t *testing.T) { {"v.array.42", false}, }}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "EmptyDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", bson.D{}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Document": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"foo", bson.D{{"v", "foo"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", bson.D{{"v", "foo"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IDType": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"_id", bson.D{{"$type", "$v"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DocumentAndValue": { pipeline: bson.A{ @@ -2023,58 +1820,50 @@ func TestAggregateCompatProject(t *testing.T) { {"v", 1}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Type": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "$v"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "$foo"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "$v.foo"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursive": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"$type", "$v"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"$non-existent", "$v"}}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "TypeRecursiveInvalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"v", "$v"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveArrayInvalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"$type", bson.A{"1", "2"}}}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "TypeInt": { @@ -2082,79 +1871,68 @@ func TestAggregateCompatProject(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", int32(42)}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeLong": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", int64(42)}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeString": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", "42"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{{"foo", "bar"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeEmpty": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.D{}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeArraySingleItem": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.A{int32(42)}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.A{"foo", "bar"}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "TypeNestedArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", bson.A{bson.A{"foo", "bar"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeObjectID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", primitive.NewObjectID()}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeBool": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"type", bson.D{{"$type", true}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ProjectManyOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$project", bson.D{{"$type", "foo"}, {"$op", "foo"}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, } @@ -2171,7 +1949,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", "$v"}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotation": { pipeline: bson.A{ @@ -2179,7 +1956,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", "$v.foo"}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayDotNotation": { pipeline: bson.A{ @@ -2187,7 +1963,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", "$v.0.foo"}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Int": { pipeline: bson.A{ @@ -2195,7 +1970,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", int32(2)}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Long": { pipeline: bson.A{ @@ -2203,7 +1977,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", int64(3)}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Double": { pipeline: bson.A{ @@ -2211,7 +1984,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", float64(4)}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "EmptyString": { pipeline: bson.A{ @@ -2219,7 +1991,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", ""}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayEmptyVariable": { pipeline: bson.A{ @@ -2227,8 +1998,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$"}}}}, }}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "ArrayValue": { pipeline: bson.A{ @@ -2236,7 +2006,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v"}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayTwoValues": { pipeline: bson.A{ @@ -2244,7 +2013,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", "$v"}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueInt": { pipeline: bson.A{ @@ -2252,7 +2020,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", int32(1)}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayIntLongDoubleStringBool": { pipeline: bson.A{ @@ -2260,7 +2027,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{int32(2), int64(3), float64(4), "not-expression", true}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveValue": { pipeline: bson.A{ @@ -2268,7 +2034,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sumsum", bson.D{{"$sum", bson.D{{"$sum", "$v"}}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveArrayValue": { pipeline: bson.A{ @@ -2276,7 +2041,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sumsum", bson.D{{"$sum", bson.D{{"$sum", bson.A{"$v"}}}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueRecursiveInt": { pipeline: bson.A{ @@ -2284,7 +2048,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", bson.D{{"$sum", int32(2)}}}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueAndRecursiveValue": { pipeline: bson.A{ @@ -2292,7 +2055,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", bson.D{{"$sum", "$v"}}}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ArrayValueAndRecursiveArray": { pipeline: bson.A{ @@ -2300,7 +2062,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.A{"$v", bson.D{{"$sum", bson.A{"$v"}}}}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Type": { pipeline: bson.A{ @@ -2308,7 +2069,6 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sumtype", bson.D{{"$sum", bson.D{{"$type", "$v"}}}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "RecursiveEmptyVariable": { pipeline: bson.A{ @@ -2316,8 +2076,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.D{{"$sum", "$$$"}}}}}, }}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "MultipleRecursiveEmptyVariable": { pipeline: bson.A{ @@ -2325,8 +2084,7 @@ func TestAggregateCompatProjectSum(t *testing.T) { {"sum", bson.D{{"$sum", bson.D{{"$sum", bson.D{{"$sum", "$$$"}}}}}}}, }}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, } @@ -2341,94 +2099,80 @@ func TestAggregateCompatAddFields(t *testing.T) { pipeline: bson.A{ bson.D{{"$addFields", "invalid"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeBool": { pipeline: bson.A{ bson.D{{"$addFields", false}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeArray": { pipeline: bson.A{ bson.D{{"$addFields", bson.A{}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeInt32": { pipeline: bson.A{ bson.D{{"$addFields", int32(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeInt64": { pipeline: bson.A{ bson.D{{"$addFields", int64(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeFloat32": { pipeline: bson.A{ bson.D{{"$addFields", float32(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeFloat64": { pipeline: bson.A{ bson.D{{"$addFields", float64(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeNull": { pipeline: bson.A{ bson.D{{"$addFields", nil}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Include1Field": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", int32(1)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Fields": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField1", int32(1)}, {"newField2", int32(2)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Stages": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField1", int32(1)}}}}, bson.D{{"$addFields", bson.D{{"newField2", int32(2)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeDocument": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", bson.D{{"doc", int32(1)}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeNestedDocument": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", bson.D{{"doc", bson.D{{"nested", int32(1)}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeArray": { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"newField", bson.A{bson.D{{"elem", int32(1)}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "UnsupportedExpressionObject": { pipeline: bson.A{ @@ -2450,51 +2194,44 @@ func TestAggregateCompatAddFields(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"value", bson.D{{"$invalid-operator", "foo"}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Type": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "$v"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "$foo"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDotNotation": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "$v.foo"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursive": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"$type", "$v"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeRecursiveNonExistent": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"$non-existent", "$v"}}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "TypeRecursiveInvalid": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"v", "$v"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeInt": { @@ -2502,95 +2239,82 @@ func TestAggregateCompatAddFields(t *testing.T) { bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", int32(42)}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeLong": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", int64(42)}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeString": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "42"}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeDocument": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{{"foo", "bar"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeEmpty": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.D{}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "MultipleOperators": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "foo"}, {"$operator", "foo"}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "MultipleOperatorFirst": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", "foo"}, {"not-operator", "foo"}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "MultipleOperatorLast": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"not-operator", "foo"}, {"$type", "foo"}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "TypeArraySingleItem": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.A{int32(42)}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.A{"foo", "bar"}}}}}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "TypeNestedArray": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", bson.A{bson.A{"foo", "bar"}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeObjectID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", primitive.NewObjectID()}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "TypeBool": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", -1}}}}, bson.D{{"$addFields", bson.D{{"type", bson.D{{"$type", true}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "SumValue": { pipeline: bson.A{ @@ -2598,7 +2322,6 @@ func TestAggregateCompatAddFields(t *testing.T) { {"sum", bson.D{{"$sum", "$v"}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } @@ -2613,94 +2336,80 @@ func TestAggregateCompatSet(t *testing.T) { pipeline: bson.A{ bson.D{{"$set", "invalid"}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeBool": { pipeline: bson.A{ bson.D{{"$set", false}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeArray": { pipeline: bson.A{ bson.D{{"$set", bson.A{}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeInt32": { pipeline: bson.A{ bson.D{{"$set", int32(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeInt64": { pipeline: bson.A{ bson.D{{"$set", int64(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeFloat32": { pipeline: bson.A{ bson.D{{"$set", float32(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeFloat64": { pipeline: bson.A{ bson.D{{"$set", float64(1)}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeNull": { pipeline: bson.A{ bson.D{{"$set", nil}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Include1Field": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", int32(1)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Fields": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField1", int32(1)}, {"newField2", int32(2)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Include2Stages": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField1", int32(1)}}}}, bson.D{{"$set", bson.D{{"newField2", int32(2)}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeDocument": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", bson.D{{"doc", int32(1)}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeNestedDocument": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", bson.D{{"doc", bson.D{{"nested", int32(1)}}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "IncludeArray": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"newField", bson.A{bson.D{{"elem", int32(1)}}}}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "UnsupportedExpressionObject": { pipeline: bson.A{ @@ -2722,7 +2431,6 @@ func TestAggregateCompatSet(t *testing.T) { {"sum", bson.D{{"$sum", "$v"}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } testAggregateStagesCompat(t, testCases) @@ -2736,80 +2444,68 @@ func TestAggregateCompatUnset(t *testing.T) { pipeline: bson.A{ bson.D{{"$unset", bson.A{1, 2, 3}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "EmptyArray": { pipeline: bson.A{ bson.D{{"$unset", bson.A{}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "EmptyString": { pipeline: bson.A{ bson.D{{"$unset", ""}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "ArrayWithEmptyString": { pipeline: bson.A{ bson.D{{"$unset", bson.A{""}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidTypeArrayWithDifferentTypes": { pipeline: bson.A{ bson.D{{"$unset", bson.A{"v", 42, false}}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "InvalidType": { pipeline: bson.A{ bson.D{{"$unset", false}}, }, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", + resultType: emptyResult, }, "Unset1Field": { pipeline: bson.A{ bson.D{{"$unset", "v"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "UnsetID": { pipeline: bson.A{ bson.D{{"$sort", bson.D{{"_id", 1}}}}, bson.D{{"$unset", "_id"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "Unset2Fields": { pipeline: bson.A{ bson.D{{"$unset", bson.A{"_id", "v"}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationUnset": { pipeline: bson.A{ bson.D{{"$unset", "v.foo"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationUnsetTwo": { pipeline: bson.A{ bson.D{{"$unset", bson.A{"v.foo", "v.array"}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "DotNotationUnsetSecondLevel": { pipeline: bson.A{ bson.D{{"$unset", "v.array.42"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, } testAggregateStagesCompat(t, testCases) diff --git a/integration/aggregate_documents_test.go b/integration/aggregate_documents_test.go index 1acfd3332d56..015368fcdf39 100644 --- a/integration/aggregate_documents_test.go +++ b/integration/aggregate_documents_test.go @@ -872,8 +872,8 @@ func TestAggregateUnsetErrors(t *testing.T) { } } -func TestAggregateSortErrors(t *testing.T) { - t.Parallel() +func TestAggregateSortErrors(tt *testing.T) { + tt.Parallel() for name, tc := range map[string]struct { //nolint:vet // used for test only pipeline bson.A // required, aggregation pipeline stages @@ -894,12 +894,14 @@ func TestAggregateSortErrors(t *testing.T) { }, } { name, tc := name, tc - t.Run(name, func(t *testing.T) { + tt.Run(name, func(tt *testing.T) { if tc.skip != "" { - t.Skip(tc.skip) + tt.Skip(tc.skip) } - t.Parallel() + tt.Parallel() + + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3148") require.NotNil(t, tc.pipeline, "pipeline must not be nil") require.NotNil(t, tc.err, "err must not be nil") diff --git a/integration/aggregate_query_test.go b/integration/aggregate_query_test.go index dffc0f80e2a9..fa2e1d00dec9 100644 --- a/integration/aggregate_query_test.go +++ b/integration/aggregate_query_test.go @@ -25,17 +25,18 @@ import ( "github.com/FerretDB/FerretDB/integration/shareddata" ) -func TestAggregateMatchExprErrors(t *testing.T) { - t.Parallel() +func TestAggregateMatchExprErrors(tt *testing.T) { + tt.Parallel() - ctx, collection := setup.Setup(t, shareddata.Composites) + ctx, collection := setup.Setup(tt, shareddata.Composites) for name, tc := range map[string]struct { //nolint:vet // used for test only pipeline bson.A // required, aggregation pipeline stages - err *mongo.CommandError // required - altMessage string // optional, alternative error message - skip string // optional, skip test with a specified reason + err *mongo.CommandError // required + altMessage string // optional, alternative error message + skip string // optional, skip test with a specified reason + failsForSQLite string // optional, if set, the case is expected to fail for SQLite due to given issue} }{ "TooManyFields": { pipeline: bson.A{ @@ -173,12 +174,14 @@ func TestAggregateMatchExprErrors(t *testing.T) { }, } { name, tc := name, tc - t.Run(name, func(t *testing.T) { + tt.Run(name, func(tt *testing.T) { if tc.skip != "" { - t.Skip(tc.skip) + tt.Skip(tc.skip) } - t.Parallel() + tt.Parallel() + + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3148") require.NotNil(t, tc.pipeline, "pipeline must not be nil") require.NotNil(t, tc.err, "err must not be nil") diff --git a/integration/aggregate_variables_compat_test.go b/integration/aggregate_variables_compat_test.go index f857526fce86..2a52ae389932 100644 --- a/integration/aggregate_variables_compat_test.go +++ b/integration/aggregate_variables_compat_test.go @@ -32,8 +32,7 @@ func TestAggregateVariablesCompatRoot(t *testing.T) { pipeline: bson.A{ bson.D{{"$addFields", bson.D{{"field", "$$ROOT"}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/1413", + skip: "https://github.com/FerretDB/FerretDB/issues/1413", }, "GroupID": { pipeline: bson.A{ @@ -41,8 +40,7 @@ func TestAggregateVariablesCompatRoot(t *testing.T) { bson.D{{"$group", bson.D{{"_id", "$$ROOT"}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/1992", + skip: "https://github.com/FerretDB/FerretDB/issues/1992", }, "GroupIDTwice": { pipeline: bson.A{ @@ -51,8 +49,7 @@ func TestAggregateVariablesCompatRoot(t *testing.T) { bson.D{{"$group", bson.D{{"_id", "$$ROOT"}}}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/1992", + skip: "https://github.com/FerretDB/FerretDB/issues/1992", }, "GroupIDExpression": { pipeline: bson.A{ @@ -62,8 +59,7 @@ func TestAggregateVariablesCompatRoot(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", 1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/1992", + skip: "https://github.com/FerretDB/FerretDB/issues/1992", }, "GroupSumAccumulator": { pipeline: bson.A{ @@ -74,7 +70,6 @@ func TestAggregateVariablesCompatRoot(t *testing.T) { }}}, bson.D{{"$sort", bson.D{{"_id", -1}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", }, "ProjectSumOperator": { pipeline: bson.A{ @@ -82,8 +77,7 @@ func TestAggregateVariablesCompatRoot(t *testing.T) { {"sum", bson.D{{"$sum", "$$ROOT"}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/1992", + skip: "https://github.com/FerretDB/FerretDB/issues/1992", }, "ProjectTypeOperator": { pipeline: bson.A{ @@ -91,22 +85,19 @@ func TestAggregateVariablesCompatRoot(t *testing.T) { {"type", bson.D{{"$type", "$$ROOT"}}}, }}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/1992", + skip: "https://github.com/FerretDB/FerretDB/issues/1992", }, "Set": { pipeline: bson.A{ bson.D{{"$set", bson.D{{"field", "$$ROOT"}}}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - skip: "https://github.com/FerretDB/FerretDB/issues/1413", + skip: "https://github.com/FerretDB/FerretDB/issues/1413", }, "Unwind": { pipeline: bson.A{ bson.D{{"$unwind", "$$ROOT"}}, }, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3148", - resultType: emptyResult, + resultType: emptyResult, }, } diff --git a/integration/findandmodify_compat_test.go b/integration/findandmodify_compat_test.go index 282bb5da410b..8065b3a10f73 100644 --- a/integration/findandmodify_compat_test.go +++ b/integration/findandmodify_compat_test.go @@ -544,7 +544,7 @@ func TestFindAndModifyCompatUpsert(t *testing.T) { {"new", true}, }, }, - "UpsertNoSuchReplaceDocument": { + "UpsertNoReplaceDocument": { command: bson.D{ {"query", bson.D{{"_id", "no-such-doc"}}}, {"update", bson.D{{"v", 43.13}}}, diff --git a/integration/findandmodify_test.go b/integration/findandmodify_test.go index bf319b2f0c21..97d338d2c9ed 100644 --- a/integration/findandmodify_test.go +++ b/integration/findandmodify_test.go @@ -588,10 +588,8 @@ func TestFindAndModifyCommandUpsert(t *testing.T) { } } -func TestFindAndModifyCommentMethod(tt *testing.T) { - tt.Parallel() - - t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3049") +func TestFindAndModifyCommentMethod(t *testing.T) { + t.Parallel() ctx, collection := setup.Setup(t, shareddata.Scalars) diff --git a/integration/helpers.go b/integration/helpers.go index e49442878afa..2c5d6d8a6869 100644 --- a/integration/helpers.go +++ b/integration/helpers.go @@ -17,7 +17,6 @@ package integration import ( "context" - "testing" "time" "github.com/stretchr/testify/assert" @@ -294,7 +293,7 @@ func AssertEqualAltCommandError(t testtb.TB, expected mongo.CommandError, altMes // AssertEqualAltWriteError asserts that the expected MongoDB error is the same as the actual; // the alternative error message may be provided if FerretDB is unable to produce exactly the same text as MongoDB. -func AssertEqualAltWriteError(t *testing.T, expected mongo.WriteError, altMessage string, actual error) bool { +func AssertEqualAltWriteError(t testtb.TB, expected mongo.WriteError, altMessage string, actual error) bool { t.Helper() we, ok := actual.(mongo.WriteException) diff --git a/integration/indexes_test.go b/integration/indexes_test.go index 09ea47461852..b0b11e8bf697 100644 --- a/integration/indexes_test.go +++ b/integration/indexes_test.go @@ -26,8 +26,8 @@ import ( "github.com/FerretDB/FerretDB/integration/shareddata" ) -func TestDropIndexesCommandErrors(t *testing.T) { - t.Parallel() +func TestDropIndexesCommandErrors(tt *testing.T) { + tt.Parallel() for name, tc := range map[string]struct { //nolint:vet // for readability toCreate []mongo.IndexModel // optional, if set, create the given indexes before drop is called @@ -132,12 +132,14 @@ func TestDropIndexesCommandErrors(t *testing.T) { }, } { name, tc := name, tc - t.Run(name, func(t *testing.T) { + tt.Run(name, func(tt *testing.T) { if tc.skip != "" { - t.Skip(tc.skip) + tt.Skip(tc.skip) } - t.Parallel() + tt.Parallel() + + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3183") if tc.command != nil { require.Nil(t, tc.toDrop, "toDrop must be nil when using command") @@ -175,8 +177,8 @@ func TestDropIndexesCommandErrors(t *testing.T) { } } -func TestCreateIndexesCommandInvalidSpec(t *testing.T) { - t.Parallel() +func TestCreateIndexesCommandInvalidSpec(tt *testing.T) { + tt.Parallel() for name, tc := range map[string]struct { indexes any // optional @@ -369,12 +371,14 @@ func TestCreateIndexesCommandInvalidSpec(t *testing.T) { }, } { name, tc := name, tc - t.Run(name, func(t *testing.T) { + tt.Run(name, func(tt *testing.T) { if tc.skip != "" { - t.Skip(tc.skip) + tt.Skip(tc.skip) } - t.Parallel() + tt.Parallel() + + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3183") if tc.missingIndexes { require.Nil(t, tc.indexes, "indexes must be nil if missingIndexes is true") @@ -409,8 +413,8 @@ func TestCreateIndexesCommandInvalidSpec(t *testing.T) { } } -func TestCreateIndexesCommandInvalidCollection(t *testing.T) { - t.Parallel() +func TestCreateIndexesCommandInvalidCollection(tt *testing.T) { + tt.Parallel() for name, tc := range map[string]struct { collectionName any @@ -465,12 +469,14 @@ func TestCreateIndexesCommandInvalidCollection(t *testing.T) { }, } { name, tc := name, tc - t.Run(name, func(t *testing.T) { + tt.Run(name, func(tt *testing.T) { if tc.skip != "" { - t.Skip(tc.skip) + tt.Skip(tc.skip) } - t.Parallel() + tt.Parallel() + + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3183") provider := shareddata.ArrayDocuments // one provider is enough to check for errors ctx, collection := setup.Setup(t, provider) @@ -489,8 +495,8 @@ func TestCreateIndexesCommandInvalidCollection(t *testing.T) { } } -func TestDropIndexesCommandInvalidCollection(t *testing.T) { - t.Parallel() +func TestDropIndexesCommandInvalidCollection(tt *testing.T) { + tt.Parallel() for name, tc := range map[string]struct { collectionName any @@ -539,12 +545,14 @@ func TestDropIndexesCommandInvalidCollection(t *testing.T) { }, } { name, tc := name, tc - t.Run(name, func(t *testing.T) { + tt.Run(name, func(tt *testing.T) { if tc.skip != "" { - t.Skip(tc.skip) + tt.Skip(tc.skip) } - t.Parallel() + tt.Parallel() + + t := setup.FailsForSQLite(tt, "https://github.com/FerretDB/FerretDB/issues/3183") provider := shareddata.ArrayDocuments // one provider is enough to check for errors ctx, collection := setup.Setup(t, provider) diff --git a/integration/insert_command_test.go b/integration/insert_command_test.go index ade17e7bf4fd..85d1518c14fa 100644 --- a/integration/insert_command_test.go +++ b/integration/insert_command_test.go @@ -121,12 +121,12 @@ func TestInsertCommandErrors(tt *testing.T) { assert.Nil(t, res) if tc.cerr != nil { - AssertEqualAltCommandError(tt, *tc.cerr, tc.altMessage, err) + AssertEqualAltCommandError(t, *tc.cerr, tc.altMessage, err) return } if tc.werr != nil { - AssertEqualAltWriteError(tt, *tc.werr, tc.altMessage, err) + AssertEqualAltWriteError(t, *tc.werr, tc.altMessage, err) return } diff --git a/integration/insert_compat_test.go b/integration/insert_compat_test.go index 16c462db385a..9532055a9501 100644 --- a/integration/insert_compat_test.go +++ b/integration/insert_compat_test.go @@ -25,7 +25,6 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" "github.com/FerretDB/FerretDB/integration/setup" - "github.com/FerretDB/FerretDB/internal/util/testutil/testtb" ) type insertCompatTestCase struct { @@ -33,38 +32,38 @@ type insertCompatTestCase struct { ordered bool // defaults to false resultType compatTestCaseResultType // defaults to nonEmptyResult - failsForSQLite string // optional, if set, the case is expected to fail for SQLite due to given issue + skipForSQLite string // optional, if set, the case is skipped for SQLite due to given issue } // testInsertCompat tests insert compatibility test cases. -func testInsertCompat(tt *testing.T, testCases map[string]insertCompatTestCase) { - tt.Helper() +func testInsertCompat(t *testing.T, testCases map[string]insertCompatTestCase) { + t.Helper() for name, tc := range testCases { name, tc := name, tc - tt.Run(name, func(tt *testing.T) { - tt.Helper() - tt.Parallel() - tt.Run("InsertOne", func(tt *testing.T) { - tt.Helper() - tt.Parallel() + if tc.skipForSQLite != "" && setup.IsSQLite(t) { + t.Skipf(tc.skipForSQLite) + } - ctx, targetCollections, compatCollections := setup.SetupCompat(tt) + t.Run(name, func(t *testing.T) { + t.Helper() + t.Parallel() + + t.Run("InsertOne", func(t *testing.T) { + t.Helper() + t.Parallel() + + ctx, targetCollections, compatCollections := setup.SetupCompat(t) insert := tc.insert - require.NotEmpty(tt, insert, "insert should be set") + require.NotEmpty(t, insert, "insert should be set") for i := range targetCollections { targetCollection := targetCollections[i] compatCollection := compatCollections[i] - tt.Run(targetCollection.Name(), func(tt *testing.T) { - tt.Helper() - - var t testtb.TB = tt - if tc.failsForSQLite != "" { - t = setup.FailsForSQLite(tt, tc.failsForSQLite) - } + t.Run(targetCollection.Name(), func(t *testing.T) { + t.Helper() for _, doc := range insert { targetInsertRes, targetErr := targetCollection.InsertOne(ctx, doc) @@ -99,26 +98,22 @@ func testInsertCompat(tt *testing.T, testCases map[string]insertCompatTestCase) } }) - tt.Run("InsertMany", func(tt *testing.T) { - tt.Helper() - tt.Parallel() + t.Run("InsertMany", func(t *testing.T) { + t.Helper() + t.Parallel() - ctx, targetCollections, compatCollections := setup.SetupCompat(tt) + ctx, targetCollections, compatCollections := setup.SetupCompat(t) insert := tc.insert - require.NotEmpty(tt, insert, "insert should be set") + require.NotEmpty(t, insert, "insert should be set") var nonEmptyResults bool for i := range targetCollections { targetCollection := targetCollections[i] compatCollection := compatCollections[i] - tt.Run(targetCollection.Name(), func(tt *testing.T) { - tt.Helper() - var t testtb.TB = tt - if tc.failsForSQLite != "" { - t = setup.FailsForSQLite(tt, tc.failsForSQLite) - } + t.Run(targetCollection.Name(), func(t *testing.T) { + t.Helper() opts := options.InsertMany().SetOrdered(tc.ordered) targetInsertRes, targetErr := targetCollection.InsertMany(ctx, insert, opts) @@ -157,11 +152,6 @@ func testInsertCompat(tt *testing.T, testCases map[string]insertCompatTestCase) }) } - var t testtb.TB = tt - if tc.failsForSQLite != "" { - t = setup.FailsForSQLite(tt, tc.failsForSQLite) - } - switch tc.resultType { case nonEmptyResult: assert.True(t, nonEmptyResults, "expected non-empty results") @@ -184,14 +174,14 @@ func TestInsertCompat(t *testing.T) { }, "IDArray": { - insert: []any{bson.D{{"_id", bson.A{"foo", "bar"}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", + insert: []any{bson.D{{"_id", bson.A{"foo", "bar"}}}}, + resultType: emptyResult, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", }, "IDRegex": { - insert: []any{bson.D{{"_id", primitive.Regex{Pattern: "^regex$", Options: "i"}}}}, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", + insert: []any{bson.D{{"_id", primitive.Regex{Pattern: "^regex$", Options: "i"}}}}, + resultType: emptyResult, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", }, "OrderedAllErrors": { @@ -199,18 +189,18 @@ func TestInsertCompat(t *testing.T) { bson.D{{"_id", bson.A{"foo", "bar"}}}, bson.D{{"_id", primitive.Regex{Pattern: "^regex$", Options: "i"}}}, }, - ordered: true, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", + ordered: true, + resultType: emptyResult, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", }, "UnorderedAllErrors": { insert: []any{ bson.D{{"_id", bson.A{"foo", "bar"}}}, bson.D{{"_id", primitive.Regex{Pattern: "^regex$", Options: "i"}}}, }, - ordered: false, - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", + ordered: false, + resultType: emptyResult, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", }, "OrderedOneError": { @@ -219,8 +209,8 @@ func TestInsertCompat(t *testing.T) { bson.D{{"_id", primitive.Regex{Pattern: "^regex$", Options: "i"}}}, bson.D{{"_id", "2"}}, }, - ordered: true, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", + ordered: true, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", }, "UnorderedOneError": { insert: []any{ @@ -229,8 +219,8 @@ func TestInsertCompat(t *testing.T) { bson.D{{"_id", primitive.Regex{Pattern: "^regex$", Options: "i"}}}, bson.D{{"_id", "2"}}, }, - ordered: false, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", + ordered: false, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/2750", }, } diff --git a/integration/update_array_compat_test.go b/integration/update_array_compat_test.go index 674d8d735633..ae858054cfc4 100644 --- a/integration/update_array_compat_test.go +++ b/integration/update_array_compat_test.go @@ -268,7 +268,7 @@ func TestUpdateArrayCompatAddToSetEach(t *testing.T) { update: bson.D{{"$addToSet", bson.D{{"v.0.foo.0.bar", bson.D{{"$each", bson.A{int32(42)}}}}}}}, resultType: emptyResult, }, - "DotNotationPathNotExist": { + "DotNotatPathNotExist": { update: bson.D{{"$addToSet", bson.D{{"non.existent.path", bson.D{{"$each", bson.A{int32(42)}}}}}}}, }, } diff --git a/integration/update_compat_test.go b/integration/update_compat_test.go index f65b668a4bd2..3839d3f5725d 100644 --- a/integration/update_compat_test.go +++ b/integration/update_compat_test.go @@ -42,8 +42,8 @@ type updateCompatTestCase struct { resultType compatTestCaseResultType // defaults to nonEmptyResult providers []shareddata.Provider // defaults to shareddata.AllProviders() - skip string // skips test if non-empty - failsForSQLite string // optional, if set, the case is expected to fail for SQLite due to given issue + skip string // skips test if non-empty + skipForSQLite string // optional, if set, the case is skipped for SQLite due to given issue } // testUpdateCompat tests update compatibility test cases. @@ -59,6 +59,10 @@ func testUpdateCompat(t *testing.T, testCases map[string]updateCompatTestCase) { t.Skip(tc.skip) } + if tc.skipForSQLite != "" { + t.Skip(tc.skipForSQLite) + } + t.Parallel() providers := shareddata.AllProviders() @@ -550,17 +554,18 @@ func TestUpdateCompat(t *testing.T) { replace: bson.D{}, }, "ReplaceNonExistentUpsert": { - filter: bson.D{{"non-existent", "no-match"}}, - replace: bson.D{{"_id", "new"}}, - replaceOpts: options.Replace().SetUpsert(true), - resultType: emptyResult, - failsForSQLite: "https://github.com/FerretDB/FerretDB/issues/3183", + filter: bson.D{{"non-existent", "no-match"}}, + replace: bson.D{{"_id", "new"}}, + replaceOpts: options.Replace().SetUpsert(true), + resultType: emptyResult, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/3183", }, "UpdateNonExistentUpsert": { - filter: bson.D{{"_id", "non-existent"}}, - update: bson.D{{"$set", bson.D{{"v", int32(42)}}}}, - updateOpts: options.Update().SetUpsert(true), - resultType: emptyResult, + filter: bson.D{{"_id", "non-existent"}}, + update: bson.D{{"$set", bson.D{{"v", int32(42)}}}}, + updateOpts: options.Update().SetUpsert(true), + resultType: emptyResult, + skipForSQLite: "https://github.com/FerretDB/FerretDB/issues/3183", }, } diff --git a/integration/update_field_compat_test.go b/integration/update_field_compat_test.go index 217ae9fe2988..fa98b1da3fff 100644 --- a/integration/update_field_compat_test.go +++ b/integration/update_field_compat_test.go @@ -212,17 +212,17 @@ func TestUpdateFieldCompatIncComplex(t *testing.T) { "DotNotationNegativeIndex": { update: bson.D{{"$inc", bson.D{{"v.-1", int32(42)}}}}, }, - "DotNotationIndexOutsideArray": { + "DotNotatIndexOutOfArray": { update: bson.D{{"$inc", bson.D{{"v.100", int32(42)}}}}, }, - "DotNotationArrayFieldNotExist": { + "DotNotatArrayFieldNotExist": { update: bson.D{{"$inc", bson.D{{"v.array.foo", int32(1)}}}}, skip: "TODO: fix namespace error", }, - "DotNotationArrayFieldExist": { + "DotNotatArrFieldExist": { update: bson.D{{"$inc", bson.D{{"v.array.0", int32(1)}}}}, }, - "DotNotationArrayFieldValue": { + "DotNotatArrFieldValue": { update: bson.D{{"$inc", bson.D{{"v.0.foo", int32(1)}}}}, }, } @@ -959,7 +959,7 @@ func TestUpdateFieldCompatSetOnInsert(t *testing.T) { update: bson.D{{"$setOnInsert", bson.D{{"v.-1.bar", int32(1)}}}}, resultType: emptyResult, }, - "DotNotationIndexOutOfArr": { + "DotNotatIndexOutOfArr": { update: bson.D{{"$setOnInsert", bson.D{{"v.100.bar", int32(1)}}}}, resultType: emptyResult, }, @@ -1194,7 +1194,7 @@ func TestUpdateFieldCompatMul(t *testing.T) { update: bson.D{{"$mul", bson.D{{"v..", int32(45)}}}}, resultType: emptyResult, }, - "DotNotationIndexExceedsArrayLength": { + "DotNotatIndexOverArrayLen": { update: bson.D{{"$mul", bson.D{{"v.100.bar", int32(45)}}}}, }, "DotNotationFieldNumericName": {