-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_kv.go
57 lines (50 loc) · 1.01 KB
/
test_kv.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2021 The June Authors. All rights reserved.
// Use of this source code is governed by Apache License
// that can be found in the LICENSE file.
package stores3
import (
"math/rand"
"os"
"path/filepath"
"strconv"
"testing"
"github.com/pelletier/go-toml"
"github.com/reusee/e5"
"github.com/reusee/june/storekv"
"github.com/reusee/pr2"
)
func TestKV(
t *testing.T,
testKV storekv.TestKV,
newKV New,
wg *pr2.WaitGroup,
) {
defer he(nil, e5.TestingFatal(t))
//TODO
t.Skip()
configDir, err := os.UserConfigDir()
ce(err)
content, err := os.ReadFile(filepath.Join(configDir, "qcloud-cos-key.toml"))
ce(err)
var config struct {
Endpoint string
TestBucket string
Key string
Secret string
}
err = toml.Unmarshal(content, &config)
ce(err)
with := func(fn func(storekv.KV, string)) {
kv, err := newKV(
wg,
config.Endpoint,
config.Key,
config.Secret,
true,
config.TestBucket,
)
ce(err)
fn(kv, strconv.FormatInt(rand.Int63(), 10))
}
testKV(wg, t, with)
}