Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
zmoog committed Feb 23, 2024
1 parent a11ed6e commit b5146ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions x-pack/filebeat/input/awss3/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ func TestS3Poller(t *testing.T) {
Key: aws.String("key5"),
LastModified: aws.Time(time.Now()),
},
{
ETag: aws.String("etag6"),
Key: aws.String("2024-02-08T08:35:00+00:02.json.gz"),
LastModified: aws.Time(time.Now()),
},
},
}, nil
})
Expand Down Expand Up @@ -124,6 +129,10 @@ func TestS3Poller(t *testing.T) {
GetObject(gomock.Any(), gomock.Eq(bucket), gomock.Eq("key5")).
Return(nil, errFakeConnectivityFailure)

mockAPI.EXPECT().
GetObject(gomock.Any(), gomock.Eq(bucket), gomock.Eq("2024-02-08T08:35:00+00:02.json.gz")).
Return(nil, errFakeConnectivityFailure)

s3ObjProc := newS3ObjectProcessorFactory(logp.NewLogger(inputName), nil, mockAPI, nil, backupConfig{}, numberOfWorkers)
receiver := newS3Poller(logp.NewLogger(inputName), nil, mockAPI, mockPublisher, s3ObjProc, newStates(inputCtx), store, bucket, "key", "region", "provider", numberOfWorkers, pollInterval)
require.Error(t, context.DeadlineExceeded, receiver.Poll(ctx))
Expand Down

0 comments on commit b5146ca

Please sign in to comment.