@@ -50,6 +50,7 @@ func TestCreate_RunLocal(t *testing.T) {
5050 ctrl := gomock .NewController (t )
5151 mockMongodbClient := mocks .NewMockMongoDBClient (ctrl )
5252 mockDB := mocks .NewMockDatabase (ctrl )
53+ mockColl := mocks .NewMockCollection (ctrl )
5354 ctx := context .Background ()
5455
5556 testDeployments := fixture .NewMockLocalDeploymentOpts (ctrl , expectedLocalDeployment )
@@ -110,6 +111,11 @@ func TestCreate_RunLocal(t *testing.T) {
110111 Database (expectedDB ).
111112 Return (mockDB ).
112113 Times (1 )
114+ mockDB .
115+ EXPECT ().
116+ Collection (expectedCollection ).
117+ Return (mockColl ).
118+ Times (1 )
113119
114120 index := & atlasv2.ClusterSearchIndex {
115121 Analyzer : & opts .Analyzer ,
@@ -138,15 +144,15 @@ func TestCreate_RunLocal(t *testing.T) {
138144 Type : pointer .Get (search .DefaultType ),
139145 }
140146
141- mockDB .
147+ mockColl .
142148 EXPECT ().
143- SearchIndexByName (ctx , index .Name , index . CollectionName ).
149+ SearchIndexByName (ctx , index .Name ).
144150 Return (nil , mongodbclient .ErrSearchIndexNotFound ).
145151 Times (1 )
146152
147- mockDB .
153+ mockColl .
148154 EXPECT ().
149- CreateSearchIndex (ctx , expectedCollection , gomock .Any ()).
155+ CreateSearchIndex (ctx , gomock .Any ()).
150156 Return (indexWithID , nil ).
151157 Times (1 )
152158
@@ -166,6 +172,7 @@ func TestCreate_Duplicated(t *testing.T) {
166172 ctrl := gomock .NewController (t )
167173 mockMongodbClient := mocks .NewMockMongoDBClient (ctrl )
168174 mockDB := mocks .NewMockDatabase (ctrl )
175+ mockColl := mocks .NewMockCollection (ctrl )
169176 ctx := context .Background ()
170177
171178 testDeployments := fixture .NewMockLocalDeploymentOpts (ctrl , expectedLocalDeployment )
@@ -226,6 +233,11 @@ func TestCreate_Duplicated(t *testing.T) {
226233 Database (expectedDB ).
227234 Return (mockDB ).
228235 Times (1 )
236+ mockDB .
237+ EXPECT ().
238+ Collection (expectedCollection ).
239+ Return (mockColl ).
240+ Times (1 )
229241
230242 index := & atlasv2.ClusterSearchIndex {
231243 Analyzer : & opts .Analyzer ,
@@ -252,9 +264,9 @@ func TestCreate_Duplicated(t *testing.T) {
252264 IndexID : & indexID ,
253265 }
254266
255- mockDB .
267+ mockColl .
256268 EXPECT ().
257- SearchIndexByName (ctx , index .Name , index . CollectionName ).
269+ SearchIndexByName (ctx , index .Name ).
258270 Return (indexWithID , nil ).
259271 Times (1 )
260272 if err := opts .Run (ctx ); err == nil || ! errors .Is (err , ErrSearchIndexDuplicated ) {
0 commit comments