Skip to content

Commit 700b138

Browse files
committed
create indexes
1 parent 129cd21 commit 700b138

File tree

1 file changed

+63
-3
lines changed

1 file changed

+63
-3
lines changed

internal/verifier/metadata_test.go

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,39 @@ func (suite *IntegrationTestSuite) TestShardingMismatch() {
7676
shardCollection(
7777
suite.srcMongoClient,
7878
"id_and_foo",
79-
bson.D{{"_id", "hashed"}, {"foo", 1}},
79+
bson.D{{"_id", "1"}, {"foo", 1}},
8080
"src",
8181
)
82+
} else {
83+
suite.Require().NoError(
84+
suite.srcMongoClient.Database(dbname).RunCommand(
85+
ctx,
86+
bson.D{
87+
{"createIndexes", "numtype"},
88+
{"indexes", []bson.D{
89+
{
90+
{"name", "foo_1"},
91+
{"key", bson.D{{"foo", 1}}},
92+
},
93+
}},
94+
},
95+
).Err(),
96+
)
97+
98+
suite.Require().NoError(
99+
suite.srcMongoClient.Database(dbname).RunCommand(
100+
ctx,
101+
bson.D{
102+
{"createIndexes", "id_and_foo"},
103+
{"indexes", []bson.D{
104+
{
105+
{"name", "foo_1"},
106+
{"key", bson.D{{"_id", "1"}, {"foo", 1}}},
107+
},
108+
}},
109+
},
110+
).Err(),
111+
)
82112
}
83113

84114
if dstInfo.Topology == util.TopologySharded {
@@ -104,15 +134,45 @@ func (suite *IntegrationTestSuite) TestShardingMismatch() {
104134
shardCollection(
105135
suite.dstMongoClient,
106136
"id_and_foo",
107-
bson.D{{"foo", 1}, {"_id", "hashed"}},
137+
bson.D{{"foo", 1}, {"_id", "1"}},
108138
"dst",
109139
)
110140
shardCollection(
111141
suite.dstMongoClient,
112142
"sharded_dst",
113-
bson.D{{"foo", 1}, {"_id", "hashed"}},
143+
bson.D{{"foo", 1}},
114144
"dst",
115145
)
146+
} else {
147+
suite.Require().NoError(
148+
suite.dstMongoClient.Database(dbname).RunCommand(
149+
ctx,
150+
bson.D{
151+
{"createIndexes", "numtype"},
152+
{"indexes", []bson.D{
153+
{
154+
{"name", "foo_1"},
155+
{"key", bson.D{{"foo", float64(1)}}},
156+
},
157+
}},
158+
},
159+
).Err(),
160+
)
161+
162+
suite.Require().NoError(
163+
suite.dstMongoClient.Database(dbname).RunCommand(
164+
ctx,
165+
bson.D{
166+
{"createIndexes", "id_and_foo"},
167+
{"indexes", []bson.D{
168+
{
169+
{"name", "foo_1"},
170+
{"key", bson.D{{"foo", 1}, {"_id", "1"}}},
171+
},
172+
}},
173+
},
174+
).Err(),
175+
)
116176
}
117177

118178
verifier := suite.BuildVerifier()

0 commit comments

Comments
 (0)