[#1103] node: Implement Get\Head
requests for EC object
All checks were successful
DCO action / DCO (pull_request) Successful in 1m44s
Vulncheck / Vulncheck (pull_request) Successful in 3m3s
Build / Build Components (1.21) (pull_request) Successful in 4m0s
Build / Build Components (1.22) (pull_request) Successful in 3m57s
Tests and linters / Staticcheck (pull_request) Successful in 4m46s
Tests and linters / gopls check (pull_request) Successful in 4m48s
Tests and linters / Lint (pull_request) Successful in 5m45s
Tests and linters / Tests (1.21) (pull_request) Successful in 8m57s
Tests and linters / Tests with -race (pull_request) Successful in 9m10s
Tests and linters / Tests (1.22) (pull_request) Successful in 9m20s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m44s
Vulncheck / Vulncheck (pull_request) Successful in 3m3s
Build / Build Components (1.21) (pull_request) Successful in 4m0s
Build / Build Components (1.22) (pull_request) Successful in 3m57s
Tests and linters / Staticcheck (pull_request) Successful in 4m46s
Tests and linters / gopls check (pull_request) Successful in 4m48s
Tests and linters / Lint (pull_request) Successful in 5m45s
Tests and linters / Tests (1.21) (pull_request) Successful in 8m57s
Tests and linters / Tests with -race (pull_request) Successful in 9m10s
Tests and linters / Tests (1.22) (pull_request) Successful in 9m20s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
167c52a1a9
commit
112a7c690f
30 changed files with 579 additions and 11 deletions
56
pkg/local_object_storage/util/ecinfo_test.go
Normal file
56
pkg/local_object_storage/util/ecinfo_test.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"testing"
|
||||
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestMergeECInfo(t *testing.T) {
|
||||
id := generateV2ID()
|
||||
target := objectSDK.NewECInfo()
|
||||
var chunk objectSDK.ECChunk
|
||||
chunk.Total = 2
|
||||
chunk.Index = 0
|
||||
chunk.SetID(id)
|
||||
target.AddChunk(chunk)
|
||||
|
||||
t.Run("merge empty", func(t *testing.T) {
|
||||
to := objectSDK.NewECInfo()
|
||||
|
||||
result := MergeECInfo(target, to)
|
||||
require.Equal(t, result, target)
|
||||
})
|
||||
|
||||
t.Run("merge existed", func(t *testing.T) {
|
||||
to := objectSDK.NewECInfo()
|
||||
to.AddChunk(chunk)
|
||||
|
||||
result := MergeECInfo(target, to)
|
||||
require.Equal(t, result, target)
|
||||
})
|
||||
t.Run("merge extend", func(t *testing.T) {
|
||||
to := objectSDK.NewECInfo()
|
||||
var chunk objectSDK.ECChunk
|
||||
chunk.Total = 2
|
||||
chunk.Index = 1
|
||||
chunk.SetID(generateV2ID())
|
||||
to.AddChunk(chunk)
|
||||
|
||||
result := MergeECInfo(target, to)
|
||||
require.Equal(t, len(result.Chunks), 2)
|
||||
})
|
||||
}
|
||||
|
||||
func generateV2ID() oid.ID {
|
||||
var buf [32]byte
|
||||
_, _ = rand.Read(buf[:])
|
||||
|
||||
var id oid.ID
|
||||
_ = id.Decode(buf[:])
|
||||
|
||||
return id
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue