forked from TrueCloudLab/frostfs-s3-gw
[#253] Caches refactoring
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
951eb6fda8
commit
19b917e3b5
30 changed files with 365 additions and 322 deletions
14
api/cache/objects_test.go
vendored
14
api/cache/objects_test.go
vendored
|
@ -9,10 +9,12 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
cachesize = 10
|
||||
lifetime = time.Second * 5
|
||||
)
|
||||
func getTestConfig() *Config {
|
||||
return &Config{
|
||||
Size: 10,
|
||||
Lifetime: 5 * time.Second,
|
||||
}
|
||||
}
|
||||
|
||||
func TestCache(t *testing.T) {
|
||||
obj := objecttest.Object()
|
||||
|
@ -21,7 +23,7 @@ func TestCache(t *testing.T) {
|
|||
address.SetObjectID(obj.ID())
|
||||
|
||||
t.Run("check get", func(t *testing.T) {
|
||||
cache := New(cachesize, lifetime)
|
||||
cache := New(getTestConfig())
|
||||
err := cache.Put(*obj)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -30,7 +32,7 @@ func TestCache(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("check delete", func(t *testing.T) {
|
||||
cache := New(cachesize, lifetime)
|
||||
cache := New(getTestConfig())
|
||||
err := cache.Put(*obj)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue