diff --git a/mongo/integration/index_view_test.go b/mongo/integration/index_view_test.go index 769e844cec..3a8950058f 100644 --- a/mongo/integration/index_view_test.go +++ b/mongo/integration/index_view_test.go @@ -71,31 +71,36 @@ func TestIndexView(t *testing.T) { }) }) mt.Run("all options", func(mt *mtest.T) { + opts := options.Index(). + SetBackground(false). + SetExpireAfterSeconds(10). + SetName("a"). + SetSparse(false). + SetUnique(false). + SetVersion(1). + SetDefaultLanguage("english"). + SetLanguageOverride("english"). + SetTextVersion(1). + SetWeights(bson.D{}). + SetSphereVersion(1). + SetBits(2). + SetMax(10). + SetMin(1). + SetPartialFilterExpression(bson.D{}). + SetStorageEngine(bson.D{ + {"wiredTiger", bson.D{ + {"configString", "block_compressor=zlib"}, + }}, + }) + + // Only check SetBucketSize if version is less than 4.9 + if mtest.CompareServerVersions(mtest.ServerVersion(), "4.9") < 0 { + opts.SetBucketSize(1) + } // Omits collation option because it's incompatible with version option _, err := mt.Coll.Indexes().CreateOne(mtest.Background, mongo.IndexModel{ - Keys: bson.D{{"foo", "text"}}, - Options: options.Index(). - SetBackground(false). - SetExpireAfterSeconds(10). - SetName("a"). - SetSparse(false). - SetUnique(false). - SetVersion(1). - SetDefaultLanguage("english"). - SetLanguageOverride("english"). - SetTextVersion(1). - SetWeights(bson.D{}). - SetSphereVersion(1). - SetBits(2). - SetMax(10). - SetMin(1). - SetBucketSize(1). - SetPartialFilterExpression(bson.D{}). - SetStorageEngine(bson.D{ - {"wiredTiger", bson.D{ - {"configString", "block_compressor=zlib"}, - }}, - }), + Keys: bson.D{{"foo", "text"}}, + Options: opts, }) assert.Nil(mt, err, "CreateOne error: %v", err) })