fsys/s3_errors_test.go
2024-11-21 12:12:05 -05:00

29 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("nonexistent")
assert.Error(t, err)
assert.Equal(t, ErrFileNotFound, err)
t.Log("== FolderNotExistErr ==")
_, err = stor.ReadDir("nonexistent")
assert.Error(t, err)
assert.Equal(t, ErrFolderNotFound, err)
}