@@ -26,6 +26,7 @@ import (
2626
2727 enterpriseApi "github.com/splunk/splunk-operator/api/v4"
2828
29+ "github.com/aws/aws-sdk-go-v2/aws"
2930 "github.com/aws/aws-sdk-go-v2/feature/s3/manager"
3031 "github.com/aws/aws-sdk-go-v2/service/s3"
3132)
@@ -104,6 +105,13 @@ func (mockClient MockAWSS3Client) GetObject(ctx context.Context, input *s3.GetOb
104105 return output , nil
105106}
106107
108+ // HeadObject is a mock call to HeadObject
109+ func (mockClient MockAWSS3Client ) HeadObject (ctx context.Context , input * s3.HeadObjectInput , options ... func (* s3.Options )) (* s3.HeadObjectOutput , error ) {
110+ return & s3.HeadObjectOutput {
111+ ETag : aws .String ("" ),
112+ }, nil
113+ }
114+
107115// ListObjectsV2 is a mock call to ListObjectsV2
108116func (mockClient MockAWSS3ClientError ) ListObjectsV2 (ctx context.Context , input * s3.ListObjectsV2Input , options ... func (* s3.Options )) (* s3.ListObjectsV2Output , error ) {
109117 return & s3.ListObjectsV2Output {}, errors .New ("Dummy Error" )
@@ -114,6 +122,11 @@ func (mockClient MockAWSS3ClientError) GetObject(ctx context.Context, input *s3.
114122 return & s3.GetObjectOutput {}, errors .New ("Dummy Error" )
115123}
116124
125+ // HeadObject is a mock call to HeadObject
126+ func (mockClient MockAWSS3ClientError ) HeadObject (ctx context.Context , input * s3.HeadObjectInput , options ... func (* s3.Options )) (* s3.HeadObjectOutput , error ) {
127+ return & s3.HeadObjectOutput {}, errors .New ("dummy Error" )
128+ }
129+
117130// MockAWSDownloadClient is mock aws client for download
118131type MockAWSDownloadClient struct {}
119132
@@ -123,10 +136,9 @@ func (mockDownloadClient MockAWSDownloadClient) Download(ctx context.Context, w
123136 var bytes int64
124137 remoteFile := * input .Key
125138 localFile := w .(* os.File ).Name ()
126- eTag := * input .IfMatch
127139
128- if remoteFile == "" || localFile == "" || eTag == "" {
129- err := fmt .Errorf ("empty localFile/remoteFile/eTag. remoteFile=%s, localFile=%s, etag=%s " , remoteFile , localFile , eTag )
140+ if remoteFile == "" || localFile == "" {
141+ err := fmt .Errorf ("empty localFile/remoteFile/eTag. remoteFile=%s, localFile=%s" , remoteFile , localFile )
130142 return bytes , err
131143 }
132144
0 commit comments