2024-11-21 18:05:00 +01:00
|
|
|
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 ==")
|
2024-11-21 18:12:05 +01:00
|
|
|
_, err = stor.Stat("nonexistent")
|
2024-11-21 18:05:00 +01:00
|
|
|
assert.Error(t, err)
|
|
|
|
assert.Equal(t, ErrFileNotFound, err)
|
|
|
|
|
|
|
|
t.Log("== FolderNotExistErr ==")
|
2024-11-21 18:12:05 +01:00
|
|
|
_, err = stor.ReadDir("nonexistent")
|
2024-11-21 18:05:00 +01:00
|
|
|
assert.Error(t, err)
|
|
|
|
assert.Equal(t, ErrFolderNotFound, err)
|
|
|
|
|
|
|
|
}
|