@@ -214,14 +214,14 @@ func TestApply(t *testing.T) {
214
214
oplogFile string
215
215
db string
216
216
coll string
217
- idxs bson.D
217
+ idxs bson.M
218
218
}{
219
219
{
220
220
desc : "index: dropIndexes-createIndexes" ,
221
221
oplogFile : "ops_cmd_createIndexes_dropIndexes" ,
222
222
db : "mydb" ,
223
223
coll : "c1" ,
224
- idxs : bson.D {{ "fieldX" , - 1 }, { "fieldZ" , - 1 } },
224
+ idxs : bson.M { "fieldX" : - 1 , "fieldZ" : - 1 },
225
225
},
226
226
// todo: add more cases
227
227
}
@@ -237,13 +237,13 @@ func TestApply(t *testing.T) {
237
237
t .Fatalf ("error while applying oplog: %v" , err )
238
238
}
239
239
240
- idxs := oRestore .indexCatalog .GetIndexes (tC .db , tC .coll )
241
- if len (idxs ) != len (tC .idxs ) {
242
- t .Errorf ("wrong number of indexes: want=%d, got=%d" , len (tC .idxs ), len (idxs ))
240
+ idxDocs := oRestore .indexCatalog .GetIndexes (tC .db , tC .coll )
241
+ if len (idxDocs ) != len (tC .idxs ) {
242
+ t .Errorf ("wrong number of indexes: want=%d, got=%d" , len (tC .idxs ), len (idxDocs ))
243
243
}
244
- for i , idx := range idxs {
245
- if idx . Key [ 0 ]. Key ! = tC .idxs [i ].Key {
246
- t .Errorf ("wrong key: want=%v, got=%v " , tC . idxs [ i ], idx .Key [0 ])
244
+ for _ , idxDoc := range idxDocs {
245
+ if _ , ok : = tC .idxs [idxDoc . Key [ 0 ].Key ]; ! ok {
246
+ t .Errorf ("wrong key: %v " , idxDoc .Key [0 ])
247
247
}
248
248
}
249
249
})
0 commit comments