From c55ff26f41db95c6c32625dac4a8039df1a20055 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 24 May 2023 19:58:29 +0100 Subject: [PATCH 1/2] WIP --- integration/count_command_compat_test.go | 10 +++++----- ..._compat_test.go => insert_command_compat_test.go} | 12 ++++++------ ..._command_test.go => query_command_compat_test.go} | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) rename integration/{insert_run_command_compat_test.go => insert_command_compat_test.go} (88%) rename integration/{query_compat_command_test.go => query_command_compat_test.go} (94%) diff --git a/integration/count_command_compat_test.go b/integration/count_command_compat_test.go index 3673d3bda5a2..2cd6e241fef1 100644 --- a/integration/count_command_compat_test.go +++ b/integration/count_command_compat_test.go @@ -25,7 +25,7 @@ import ( "github.com/FerretDB/FerretDB/integration/setup" ) -type countCompatCommandTestCase struct { +type countCommandCompatTestCase struct { skipForTigris string skip string collectionName any @@ -33,7 +33,7 @@ type countCompatCommandTestCase struct { } // testQueryCompat tests query compatibility test cases. -func testCountCompatCommand(t *testing.T, testCases map[string]countCompatCommandTestCase) { +func testCountCommandCompat(t *testing.T, testCases map[string]countCommandCompatTestCase) { t.Helper() // Use shared setup because count queries can't modify data. @@ -114,10 +114,10 @@ func testCountCompatCommand(t *testing.T, testCases map[string]countCompatComman } } -func TestCountCompatCommandErrors(t *testing.T) { +func TestCountCommandCompatErrors(t *testing.T) { t.Parallel() - testCases := map[string]countCompatCommandTestCase{ + testCases := map[string]countCommandCompatTestCase{ "Pass": { command: bson.D{ {"query", bson.D{}}, @@ -207,5 +207,5 @@ func TestCountCompatCommandErrors(t *testing.T) { }, } - testCountCompatCommand(t, testCases) + testCountCommandCompat(t, testCases) } diff --git a/integration/insert_run_command_compat_test.go b/integration/insert_command_compat_test.go similarity index 88% rename from integration/insert_run_command_compat_test.go rename to integration/insert_command_compat_test.go index 0a9ce4cbc05c..a5f00635b1b2 100644 --- a/integration/insert_run_command_compat_test.go +++ b/integration/insert_command_compat_test.go @@ -24,7 +24,7 @@ import ( "github.com/FerretDB/FerretDB/integration/setup" ) -type insertRunCommandCompatTestCase struct { +type insertCommandCompatTestCase struct { altErrorMsg string // optional, alternative error message in case of error ordered any // required, ordered parameter documents []any // required, slice of bson.D to be insert @@ -32,9 +32,9 @@ type insertRunCommandCompatTestCase struct { skip string // optional, reason to skip the test } -// testInsertRunCommandCompat tests insert compatibility test cases with invalid parameters. +// testInsertCommandCompat tests insert compatibility test cases with invalid parameters. // It uses runCommand instead of insertOne or insertMany to let more invalid parameters being used. -func testInsertRunCommandCompat(t *testing.T, testCases map[string]insertRunCommandCompatTestCase) { +func testInsertCommandCompat(t *testing.T, testCases map[string]insertCommandCompatTestCase) { t.Helper() for name, tc := range testCases { @@ -90,10 +90,10 @@ func testInsertRunCommandCompat(t *testing.T, testCases map[string]insertRunComm } } -func TestInsertRunCommandCompat(t *testing.T) { +func TestInsertCommandCompat(t *testing.T) { t.Parallel() - testCases := map[string]insertRunCommandCompatTestCase{ + testCases := map[string]insertCommandCompatTestCase{ "InsertOrderedInvalid": { documents: []any{ bson.D{{"_id", "foo"}}, @@ -110,5 +110,5 @@ func TestInsertRunCommandCompat(t *testing.T) { }, } - testInsertRunCommandCompat(t, testCases) + testInsertCommandCompat(t, testCases) } diff --git a/integration/query_compat_command_test.go b/integration/query_command_compat_test.go similarity index 94% rename from integration/query_compat_command_test.go rename to integration/query_command_compat_test.go index c57c30ebf6d9..d8e139bc5237 100644 --- a/integration/query_compat_command_test.go +++ b/integration/query_command_compat_test.go @@ -26,10 +26,10 @@ import ( "github.com/FerretDB/FerretDB/integration/setup" ) -// queryCompatTestCase describes query compatibility test case. +// queryCommandCompatTestCase describes query compatibility test case. // //nolint:vet // for readability -type queryCompatCommandTestCase struct { +type queryCommandCompatTestCase struct { filter bson.D // required sort bson.D // defaults to `bson.D{{"_id", 1}}` projection bson.D // nil for leaving projection unset @@ -44,7 +44,7 @@ type queryCompatCommandTestCase struct { } // testQueryCompat tests query compatibility test cases. -func testQueryCompatCommand(t *testing.T, testCases map[string]queryCompatCommandTestCase) { +func testQueryCommandCompat(t *testing.T, testCases map[string]queryCommandCompatTestCase) { t.Helper() // Use shared setup because find queries can't modify data. @@ -171,10 +171,10 @@ func testQueryCompatCommand(t *testing.T, testCases map[string]queryCompatComman } } -func TestQueryCompatCommandSkip(t *testing.T) { +func TestQueryCommandCompatSkip(t *testing.T) { t.Parallel() - testCases := map[string]queryCompatCommandTestCase{ + testCases := map[string]queryCommandCompatTestCase{ "MaxInt64": { filter: bson.D{}, optSkip: math.MaxInt64, @@ -205,5 +205,5 @@ func TestQueryCompatCommandSkip(t *testing.T) { }, } - testQueryCompatCommand(t, testCases) + testQueryCommandCompat(t, testCases) } From d32021b5453d6896b6d289206982cfe5bae3214d Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 30 May 2023 13:44:37 +0100 Subject: [PATCH 2/2] WIP --- integration/insert_command_compat_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/insert_command_compat_test.go b/integration/insert_command_compat_test.go index a5f00635b1b2..686d140b626e 100644 --- a/integration/insert_command_compat_test.go +++ b/integration/insert_command_compat_test.go @@ -24,7 +24,7 @@ import ( "github.com/FerretDB/FerretDB/integration/setup" ) -type insertCommandCompatTestCase struct { +type insertCommandCompatTestCase struct { //nolint:vet // for readability altErrorMsg string // optional, alternative error message in case of error ordered any // required, ordered parameter documents []any // required, slice of bson.D to be insert