-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathstorage_test.go
38 lines (32 loc) · 1013 Bytes
/
storage_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package gilfoyle
import (
"github.com/dreamvo/gilfoyle/config"
"github.com/dreamvo/gilfoyle/storage"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"testing"
)
func TestStorage(t *testing.T) {
t.Run("should use non-existing storage driver", func(t *testing.T) {
_, err := NewStorage("test")
assert.EqualError(t, err, "storage driver test does not exist")
})
t.Run("should initialize Filesystem storage", func(t *testing.T) {
_, err := NewStorage(storage.Filesystem)
assert.NoError(t, err)
})
t.Run("should initialize S3 storage", func(t *testing.T) {
// Skipping as it continuously fail
// We should NOT rely on the network anymore
t.Skip()
Config.Storage.S3 = config.S3Config{
Hostname: "play.min.io",
AccessKeyID: "Q3AM3UQ867SPQQA43P2F",
SecretAccessKey: "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
Bucket: uuid.New().String(),
EnableSSL: true,
}
_, err := NewStorage(storage.AmazonS3)
assert.NoError(t, err)
})
}