Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaydubina committed Feb 22, 2024
1 parent 1a32a96 commit 1acdb04
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions aws_s3_reader_seeker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,29 @@ func TestS3ReadSeeker_SeekDiscardHTTPBody(t *testing.T) {
t.Errorf("expected %d bytes, got %d", len(exp), len(got1))
}
}

func TestS3ReadSeeker_NotFoundObject(t *testing.T) {
mySession := session.Must(session.NewSession(
aws.NewConfig().WithRegion("ap-southeast-1"),
))
s3client := s3.New(mySession)

bucket := "nikolaydubina-blog-public"
key := "something-something"

r := awss3reader.NewS3ReadSeeker(
s3client,
bucket,
key,
awss3reader.FixedChunkSizePolicy{Size: 1 << 10 * 100}, // 100 KB
)
defer r.Close()

if _, err := r.Seek(100, io.SeekEnd); err == nil {
t.Errorf("expected error, got nil")
}

if _, err := io.ReadAll(r); err == nil {
t.Errorf("expected error, got nil")
}
}

0 comments on commit 1acdb04

Please sign in to comment.