@@ -178,6 +178,45 @@ func Test_alterCollectionTask_Execute(t *testing.T) {
178178 assert .Error (t , err )
179179 })
180180
181+ t .Run ("alter successfully" , func (t * testing.T ) {
182+ meta := mockrootcoord .NewIMetaTable (t )
183+ meta .On ("GetCollectionByName" ,
184+ mock .Anything ,
185+ mock .Anything ,
186+ mock .Anything ,
187+ mock .Anything ,
188+ ).Return (& model.Collection {
189+ CollectionID : int64 (1 ),
190+ Properties : []* commonpb.KeyValuePair {
191+ {
192+ Key : common .CollectionTTLConfigKey ,
193+ Value : "1" ,
194+ },
195+ {
196+ Key : common .CollectionAutoCompactionKey ,
197+ Value : "true" ,
198+ },
199+ },
200+ }, nil )
201+ core := newTestCore (withValidProxyManager (), withMeta (meta ))
202+ task := & alterCollectionTask {
203+ baseTask : newBaseTask (context .Background (), core ),
204+ Req : & milvuspb.AlterCollectionRequest {
205+ Base : & commonpb.MsgBase {MsgType : commonpb .MsgType_AlterCollection },
206+ CollectionName : "cn" ,
207+ Properties : []* commonpb.KeyValuePair {
208+ {
209+ Key : common .CollectionAutoCompactionKey ,
210+ Value : "true" ,
211+ },
212+ },
213+ },
214+ }
215+
216+ err := task .Execute (context .Background ())
217+ assert .NoError (t , err )
218+ })
219+
181220 t .Run ("alter successfully" , func (t * testing.T ) {
182221 meta := mockrootcoord .NewIMetaTable (t )
183222 meta .On ("GetCollectionByName" ,
0 commit comments