Skip to content

Commit

Permalink
Check test database name length in compat test setup (#2527)
Browse files Browse the repository at this point in the history
Closes #2065.
  • Loading branch information
chilagrow authored May 1, 2023
1 parent 6e0bd57 commit 93190b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions integration/setup/setup_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func SetupCompatWithOpts(tb testing.TB, opts *SetupCompatOpts) *SetupCompatResul
// Add the backend's name to prevent the usage of the same database.
opts.databaseName = testutil.DatabaseName(tb) + "_" + suffix

// When database name is too long, database is created but inserting documents
// fail with InvalidNamespace error.
require.Less(tb, len(opts.databaseName), 64, "database name is too long")

opts.baseCollectionName = testutil.CollectionName(tb)

level := zap.NewAtomicLevelAt(zap.ErrorLevel)
Expand Down
13 changes: 5 additions & 8 deletions integration/update_field_compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,9 @@ func TestUpdateFieldCompatRename(t *testing.T) {
update: bson.D{{"$rename", bson.D{{"v.foo", "v.array"}}}},
skipForTigris: "https://github.com/FerretDB/FerretDB/issues/1776",
},
"DotNotationDocumentNotExistentPath": {
"DotNotationDocNonExistent": {
update: bson.D{{"$rename", bson.D{{"not.existent.path", ""}}}},
resultType: emptyResult,
skip: "https://github.com/FerretDB/FerretDB/issues/2065",
},
"DotNotationArrayField": {
update: bson.D{{"$rename", bson.D{{"v.array.0", ""}}}},
Expand Down Expand Up @@ -656,10 +655,9 @@ func TestUpdateFieldCompatUnset(t *testing.T) {
update: bson.D{{"$unset", bson.D{{"v.array.0", ""}}}},
skip: "https://github.com/FerretDB/FerretDB/issues/1242",
},
"DotNotationArrayNonExistentPath": {
"DotNotationArrNonExistentPath": {
update: bson.D{{"$unset", bson.D{{"non.0.existent", int32(1)}}}},
resultType: emptyResult,
skip: "https://github.com/FerretDB/FerretDB/issues/2065",
},
"DotNotationMissingField": {
update: bson.D{{"$unset", bson.D{{"v..", ""}}}},
Expand Down Expand Up @@ -976,10 +974,9 @@ func TestUpdateFieldCompatSetOnInsert(t *testing.T) {
update: bson.D{{"$setOnInsert", bson.D{{"v.-1.bar", int32(1)}}}},
resultType: emptyResult,
},
"DotNotationIndexOutOfArray": {
update: bson.D{{"$setOnInsert", bson.D{{"v.100.bar", int32(1)}}}},
resultType: emptyResult,
skipForTigris: "https://github.com/FerretDB/FerretDB/issues/2065",
"DotNotationIndexOutOfArr": {
update: bson.D{{"$setOnInsert", bson.D{{"v.100.bar", int32(1)}}}},
resultType: emptyResult,
},
}

Expand Down

0 comments on commit 93190b7

Please sign in to comment.