Skip to content

Commit dc7f509

Browse files
author
Aaron Schlesinger
committed
fix(pkg/gitreceive/storage/object_test.go): add test for when the object statter errors
1 parent 29d302f commit dc7f509

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

pkg/gitreceive/storage/object_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package storage
22

33
import (
4+
"errors"
45
"testing"
56

67
"github.com/arschles/assert"
@@ -37,3 +38,15 @@ func TestObjectExistsNoObject(t *testing.T) {
3738
assert.False(t, exists, "object found when it should be missing")
3839
assert.Equal(t, len(statter.Calls), 1, "number of StatObject calls")
3940
}
41+
42+
func TestObjectExistsOtherErr(t *testing.T) {
43+
expectedErr := errors.New("other error")
44+
statter := &FakeObjectStatter{
45+
Fn: func(string, string) (s3.ObjectInfo, error) {
46+
return s3.ObjectInfo{}, expectedErr
47+
},
48+
}
49+
exists, err := ObjectExists(statter, bucketName, objKey)
50+
assert.Err(t, err, expectedErr)
51+
assert.False(t, exists, "object found when the statter errored")
52+
}

0 commit comments

Comments
 (0)