forked from TrueCloudLab/frostfs-node
[#188] blobstor: Refactor blobstor test
Resolve funlen linter for TestIterate function Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
594b5821ed
commit
8273a3dfb2
1 changed files with 12 additions and 1 deletions
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// nolint: funlen
|
||||
func TestIterate(t *testing.T, cons Constructor, min, max uint64) {
|
||||
s := cons(t)
|
||||
require.NoError(t, s.Open(false))
|
||||
|
@ -28,6 +27,14 @@ func TestIterate(t *testing.T, cons Constructor, min, max uint64) {
|
|||
|
||||
objects = append(objects[:delID], objects[delID+1:]...)
|
||||
|
||||
runTestNormalHandler(t, s, objects)
|
||||
|
||||
runTestLazyHandler(t, s, objects)
|
||||
|
||||
runTestIgnoreLogicalErrors(t, s, objects)
|
||||
}
|
||||
|
||||
func runTestNormalHandler(t *testing.T, s common.Storage, objects []objectDesc) {
|
||||
t.Run("normal handler", func(t *testing.T) {
|
||||
seen := make(map[string]objectDesc)
|
||||
|
||||
|
@ -52,7 +59,9 @@ func TestIterate(t *testing.T, cons Constructor, min, max uint64) {
|
|||
require.Equal(t, objects[i].storageID, d.storageID)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func runTestLazyHandler(t *testing.T, s common.Storage, objects []objectDesc) {
|
||||
t.Run("lazy handler", func(t *testing.T) {
|
||||
seen := make(map[string]func() ([]byte, error))
|
||||
|
||||
|
@ -74,7 +83,9 @@ func TestIterate(t *testing.T, cons Constructor, min, max uint64) {
|
|||
require.Equal(t, objects[i].raw, data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func runTestIgnoreLogicalErrors(t *testing.T, s common.Storage, objects []objectDesc) {
|
||||
t.Run("ignore errors doesn't work for logical errors", func(t *testing.T) {
|
||||
seen := make(map[string]objectDesc)
|
||||
|
||||
|
|
Loading…
Reference in a new issue