-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig_test.go
More file actions
29 lines (26 loc) · 953 Bytes
/
Copy pathconfig_test.go
File metadata and controls
29 lines (26 loc) · 953 Bytes
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
package conf
import (
"testing"
"github.com/drycc/builder/pkg/sys"
"github.com/stretchr/testify/assert"
)
func TestGetStorageParams(t *testing.T) {
env := sys.NewFakeEnv()
env.Envs = map[string]string{
"DRYCC_STORAGE_BUCKET": "builder",
"DRYCC_STORAGE_ENDPOINT": "http://localhost:8088",
"DRYCC_STORAGE_ACCESSKEY": "admin",
"DRYCC_STORAGE_SECRETKEY": "adminpass",
"DRYCC_STORAGE_PATH_STYLE": "true",
}
params, err := GetStorageParams(env)
if err != nil {
t.Errorf("received error while retrieving storage params: %v", err)
}
assert.Equal(t, params["forcepathstyle"], "true", "forcepathstyle")
assert.Equal(t, params["regionendpoint"], "http://localhost:8088", "region endpoint")
assert.Equal(t, params["region"], "localhost", "region")
assert.Equal(t, params["bucket"], "builder", "bucket")
assert.Equal(t, params["accesskey"], "admin", "accesskey")
assert.Equal(t, params["secretkey"], "adminpass", "secretkey")
}