@@ -35,7 +35,7 @@ import (
3535
3636// assigning mock at runtime instead of compile time
3737var minioListBucketsWithContextMock func (ctx context.Context ) ([]minio.BucketInfo , error )
38- var minioMakeBucketWithContextMock func (ctx context.Context , bucketName , location string ) error
38+ var minioMakeBucketWithContextMock func (ctx context.Context , bucketName , location string , objectLock bool ) error
3939var minioSetBucketPolicyWithContextMock func (ctx context.Context , bucketName , policy string ) error
4040var minioRemoveBucketMock func (bucketName string ) error
4141var minioGetBucketPolicyMock func (bucketName string ) (string , error )
@@ -53,8 +53,8 @@ func (mc minioClientMock) listBucketsWithContext(ctx context.Context) ([]minio.B
5353}
5454
5555// mock function of makeBucketsWithContext()
56- func (mc minioClientMock ) makeBucketWithContext (ctx context.Context , bucketName , location string ) error {
57- return minioMakeBucketWithContextMock (ctx , bucketName , location )
56+ func (mc minioClientMock ) makeBucketWithContext (ctx context.Context , bucketName , location string , objectLock bool ) error {
57+ return minioMakeBucketWithContextMock (ctx , bucketName , location , objectLock )
5858}
5959
6060// mock function of setBucketPolicyWithContext()
@@ -141,18 +141,18 @@ func TestMakeBucket(t *testing.T) {
141141 ctx := context .Background ()
142142 // Test-1: makeBucket() create a bucket
143143 // mock function response from makeBucketWithContext(ctx)
144- minioMakeBucketWithContextMock = func (ctx context.Context , bucketName , location string ) error {
144+ minioMakeBucketWithContextMock = func (ctx context.Context , bucketName , location string , objectLock bool ) error {
145145 return nil
146146 }
147- if err := makeBucket (ctx , minClient , "bucktest1" ); err != nil {
147+ if err := makeBucket (ctx , minClient , "bucktest1" , true ); err != nil {
148148 t .Errorf ("Failed on %s:, error occurred: %s" , function , err .Error ())
149149 }
150150
151151 // Test-2 makeBucket() make sure errors are handled correctly when error on MakeBucketWithContext
152- minioMakeBucketWithContextMock = func (ctx context.Context , bucketName , location string ) error {
152+ minioMakeBucketWithContextMock = func (ctx context.Context , bucketName , location string , objectLock bool ) error {
153153 return errors .New ("error" )
154154 }
155- if err := makeBucket (ctx , minClient , "bucktest1" ); assert .Error (err ) {
155+ if err := makeBucket (ctx , minClient , "bucktest1" , true ); assert .Error (err ) {
156156 assert .Equal ("error" , err .Error ())
157157 }
158158}
0 commit comments