30 lines
574 B
Go
30 lines
574 B
Go
|
package fsys
|
||
|
|
||
|
import (
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestStorageS3Errors(t *testing.T) {
|
||
|
|
||
|
stor, err := New(Config{
|
||
|
Type: "s3",
|
||
|
S3BucketName: "test",
|
||
|
S3AccessID: "root",
|
||
|
S3AccessKey: "password123",
|
||
|
S3Endpoint: "127.0.0.1:9000",
|
||
|
})
|
||
|
assert.NoError(t, err)
|
||
|
|
||
|
t.Log("== FileNotExistErr ==")
|
||
|
_, err = stor.Stat("nonexistant")
|
||
|
assert.Error(t, err)
|
||
|
assert.Equal(t, ErrFileNotFound, err)
|
||
|
|
||
|
t.Log("== FolderNotExistErr ==")
|
||
|
_, err = stor.ReadDir("nonexistant")
|
||
|
assert.Error(t, err)
|
||
|
assert.Equal(t, ErrFolderNotFound, err)
|
||
|
|
||
|
}
|