Skip to content

Commit

Permalink
fakestorage: add a test for invalid range
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Jan 3, 2025
1 parent ce3b0ea commit aa548e2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions fakestorage/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,34 @@ func TestServerClientObjectRangeReader(t *testing.T) {
})
}

func TestServerClientObjectRangeReaderInvalid(t *testing.T) {
const (
bucketName = "some-bucket"
objectName = "items/data.txt"
content = "some really nice but long content stored in my object"
contentType = "text/plain; charset=iso-8859"
)
objs := []Object{
{
ObjectAttrs: ObjectAttrs{
BucketName: bucketName,
Name: objectName,
ContentType: contentType,
},
Content: []byte(content),
},
}

runServersTest(t, runServersOptions{objs: objs}, func(t *testing.T, server *Server) {
client := server.Client()
objHandle := client.Bucket(bucketName).Object(objectName)
_, err := objHandle.NewRangeReader(context.TODO(), 500, 10)
if err == nil {
t.Fatal("unexpected <nil> error")
}
})
}

func TestServerClientObjectReaderAfterCreateObject(t *testing.T) {
const (
bucketName = "staging-bucket"
Expand Down

0 comments on commit aa548e2

Please sign in to comment.