fsys/s3_errors_test.go

30 lines
574 B
Go
Raw Normal View History

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