diff --git a/integration/aggregate_documents_compat_test.go b/integration/aggregate_documents_compat_test.go index 4137bbe4b9b5..e77b790948f0 100644 --- a/integration/aggregate_documents_compat_test.go +++ b/integration/aggregate_documents_compat_test.go @@ -320,6 +320,8 @@ func TestAggregateCompatOptions(t *testing.T) { } func TestAggregateCompatStages(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3520") + t.Parallel() testCases := map[string]aggregateStagesCompatTestCase{ @@ -902,6 +904,8 @@ func TestAggregateCompatGroupCount(t *testing.T) { } func TestAggregateCompatLimit(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3520") + t.Parallel() testCases := map[string]aggregateStagesCompatTestCase{ @@ -1243,6 +1247,8 @@ func TestAggregateCompatGroupSum(t *testing.T) { } func TestAggregateCompatMatch(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3520") + t.Parallel() // TODO https://github.com/FerretDB/FerretDB/issues/2291 @@ -1505,6 +1511,8 @@ func TestAggregateCompatUnwind(t *testing.T) { } func TestAggregateCompatSkip(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3520") + t.Parallel() testCases := map[string]aggregateStagesCompatTestCase{ diff --git a/integration/commands_administration_test.go b/integration/commands_administration_test.go index 30b2705ee1b4..a05cd632645e 100644 --- a/integration/commands_administration_test.go +++ b/integration/commands_administration_test.go @@ -698,6 +698,8 @@ func TestCommandsAdministrationCollStatsEmpty(t *testing.T) { } func TestCommandsAdministrationCollStats(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3521") + t.Parallel() ctx, collection := setup.Setup(t, shareddata.DocumentsStrings) @@ -730,6 +732,8 @@ func TestCommandsAdministrationCollStats(t *testing.T) { } func TestCommandsAdministrationCollStatsWithScale(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3521") + t.Parallel() ctx, collection := setup.Setup(t, shareddata.DocumentsStrings) @@ -777,6 +781,8 @@ func TestCommandsAdministrationCollStatsCount(t *testing.T) { } func TestCommandsAdministrationDataSize(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3521") + t.Parallel() t.Run("Existing", func(t *testing.T) { diff --git a/integration/query_array_compat_test.go b/integration/query_array_compat_test.go index 92eb4cd767c4..0d0cc444396f 100644 --- a/integration/query_array_compat_test.go +++ b/integration/query_array_compat_test.go @@ -20,6 +20,8 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" + + "github.com/FerretDB/FerretDB/integration/setup" ) func TestQueryArrayCompatSize(t *testing.T) { @@ -133,6 +135,8 @@ func TestQueryArrayCompatDotNotation(t *testing.T) { } func TestQueryArrayCompatElemMatch(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3526") + t.Parallel() testCases := map[string]queryCompatTestCase{ diff --git a/integration/query_comparison_compat_test.go b/integration/query_comparison_compat_test.go index 5d4f6e039267..2280ef97eee0 100644 --- a/integration/query_comparison_compat_test.go +++ b/integration/query_comparison_compat_test.go @@ -22,11 +22,14 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" + "github.com/FerretDB/FerretDB/integration/setup" "github.com/FerretDB/FerretDB/integration/shareddata" "github.com/FerretDB/FerretDB/internal/util/must" ) func TestQueryComparisonCompatImplicit(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3526") + t.Parallel() testCases := map[string]queryCompatTestCase{ @@ -291,6 +294,8 @@ func TestQueryComparisonCompatImplicit(t *testing.T) { } func TestQueryComparisonCompatEq(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3526") + t.Parallel() testCases := map[string]queryCompatTestCase{ @@ -1172,6 +1177,8 @@ func TestQueryComparisonCompatIn(t *testing.T) { } func TestQueryComparisonCompatNe(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3526") + t.Parallel() testCases := map[string]queryCompatTestCase{ @@ -1389,6 +1396,8 @@ func TestQueryComparisonCompatNe(t *testing.T) { } func TestQueryComparisonCompatMultipleOperators(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3526") + t.Parallel() var scalarDataTypesFilter bson.A diff --git a/integration/query_compat_test.go b/integration/query_compat_test.go index 2384cb6a63d0..1178b9778226 100644 --- a/integration/query_compat_test.go +++ b/integration/query_compat_test.go @@ -193,6 +193,8 @@ func testQueryCompat(t *testing.T, testCases map[string]queryCompatTestCase) { } func TestQueryCompatFilter(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3526") + t.Parallel() testCases := map[string]queryCompatTestCase{ diff --git a/integration/query_projection_compat_test.go b/integration/query_projection_compat_test.go index 9beb92a59f9a..2650ba792cf8 100644 --- a/integration/query_projection_compat_test.go +++ b/integration/query_projection_compat_test.go @@ -22,6 +22,7 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" + "github.com/FerretDB/FerretDB/integration/setup" "github.com/FerretDB/FerretDB/integration/shareddata" ) @@ -223,6 +224,8 @@ func TestQueryProjectionCompat(t *testing.T) { } func TestQueryProjectionPositionalOperatorCompat(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3526") + t.Parallel() // TODO https://github.com/FerretDB/FerretDB/issues/3053 diff --git a/integration/query_test.go b/integration/query_test.go index 3a152a8c54b6..b00d1033cbdb 100644 --- a/integration/query_test.go +++ b/integration/query_test.go @@ -821,6 +821,8 @@ func TestQueryCommandSingleBatch(t *testing.T) { } func TestQueryCommandLimitPushDown(t *testing.T) { + setup.SkipForNewPg(t, "https://github.com/FerretDB/FerretDB/issues/3416") + t.Parallel() // must use a collection of documents which does not support query pushdown to test limit pushdown diff --git a/integration/setup/client.go b/integration/setup/client.go index b770d31ee34c..6e4992782ffa 100644 --- a/integration/setup/client.go +++ b/integration/setup/client.go @@ -39,9 +39,12 @@ func makeClient(ctx context.Context, uri string) (*mongo.Client, error) { return nil, lazyerrors.Error(err) } - if err = client.Ping(ctx, nil); err != nil { - return nil, lazyerrors.Error(err) - } + // When too many connections are open, PostgreSQL returns an error, + // but this error is hanging (panic in setupClient doesn't immediately stop the test). + // TODO https://github.com/FerretDB/FerretDB/issues/3535 + //if err = client.Ping(ctx, nil); err != nil { + // return nil, lazyerrors.Error(err) + //} return client, nil } diff --git a/integration/setup/test_helpers.go b/integration/setup/test_helpers.go index 383cbf087450..6246b3e1a896 100644 --- a/integration/setup/test_helpers.go +++ b/integration/setup/test_helpers.go @@ -36,6 +36,15 @@ func IsOldPg(tb testtb.TB) bool { return *targetBackendF == "ferretdb-pg" && !*useNewPgF } +// IsNewPg returns true if the current test is running for new PostgreSQL handler. +// +// This function should not be used lightly and always with an reason provided. +// It should be removed when a new PG handler is fully supported. +// TODO https://github.com/FerretDB/FerretDB/issues/3435 +func IsNewPg(tb testtb.TB) bool { + return *targetBackendF == "ferretdb-pg" && *useNewPgF +} + // IsSQLite returns true if the current test is running for SQLite. // // This function should not be used lightly. @@ -104,6 +113,21 @@ func SkipForOldPg(tb testtb.TB, reason string) { } } +// SkipForNewPg skips the current test for the new PG handler. +// +// This function should not be used lightly and always with an reason provided. +// It should be removed when a new PG handler is fully supported. +// TODO https://github.com/FerretDB/FerretDB/issues/3435 +func SkipForNewPg(tb testtb.TB, reason string) { + tb.Helper() + + if IsNewPg(tb) { + require.NotEmpty(tb, reason, "reason must not be empty") + + tb.Skipf("Skipping for new PostgreSQL handler: %s.", reason) + } +} + // IsPushdownDisabled returns true if FerretDB pushdowns are disabled. func IsPushdownDisabled() bool { return *disableFilterPushdownF