Hello, I am a robot. #1

Closed
fyrchik wants to merge 70 commits from test-2144074865 into master
3 changed files with 19 additions and 15 deletions
Showing only changes of commit 07de839f18 - Show all commits

View file

@ -1,6 +1,8 @@
package getsvc
import (
"errors"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
@ -90,6 +92,7 @@ func (exec *execCtx) initFromChild(obj oid.ID) (prev *oid.ID, children []oid.ID)
par := child.Parent()
if par == nil {
exec.status = statusUndefined
exec.err = errors.New("received child with empty parent")
log.Debug("received child with empty parent")

View file

@ -220,6 +220,8 @@ func (exec *execCtx) getChild(id oid.ID, rng *objectSDK.Range, withHdr bool) (*o
exec.err = errors.New("wrong child header")
exec.log.Debug("parent address in child object differs")
return nil, false
}
return child, ok
@ -256,8 +258,10 @@ func (exec *execCtx) headChild(id oid.ID) (*objectSDK.Object, bool) {
if !exec.isChild(child) {
exec.status = statusUndefined
exec.err = errors.New("parent address in child object differs")
exec.log.Debug("parent address in child object differs")
return nil, false
} else {
exec.status = statusOK
exec.err = nil

View file

@ -1094,8 +1094,8 @@ func TestGetRemoteSmall(t *testing.T) {
p.WithAddress(addr)
err := svc.Get(ctx, p)
require.NoError(t, err) //TODO fix me
//require.Equal(t, err.Error(), "wrong child header")
require.Error(t, err)
require.Equal(t, err.Error(), "wrong child header")
w = NewSimpleObjectWriter()
payloadSz := srcObj.PayloadSize()
@ -1107,9 +1107,8 @@ func TestGetRemoteSmall(t *testing.T) {
rngPrm.WithAddress(addr)
err = svc.GetRange(ctx, rngPrm)
require.ErrorAs(t, err, new(*apistatus.ObjectOutOfRange)) //TODO fix me
//require.Equal(t, err.Error(), "wrong child header")
require.Error(t, err)
require.Equal(t, err.Error(), "wrong child header")
})
t.Run("linked object with parent udefined", func(t *testing.T) {
@ -1180,8 +1179,8 @@ func TestGetRemoteSmall(t *testing.T) {
p.WithAddress(addr)
err := svc.Get(ctx, p)
require.NoError(t, err) //TODO fix me
//require.Equal(t, err.Error(), "received child with empty parent")
require.Error(t, err)
require.Equal(t, err.Error(), "received child with empty parent")
w = NewSimpleObjectWriter()
payloadSz := srcObj.PayloadSize()
@ -1193,8 +1192,8 @@ func TestGetRemoteSmall(t *testing.T) {
rngPrm.WithAddress(addr)
err = svc.GetRange(ctx, rngPrm)
require.NoError(t, err) //TODO fix me
//require.Equal(t, err.Error(), "received child with empty parent")
require.Error(t, err)
require.Equal(t, err.Error(), "received child with empty parent")
})
t.Run("out of range", func(t *testing.T) {
@ -1465,9 +1464,8 @@ func TestGetRemoteSmall(t *testing.T) {
p.WithAddress(addr)
err := svc.Get(ctx, p)
require.NoError(t, err) //TODO fix me, it must be an error, corrupted chain
//require.Equal(t, err.Error(), "parent address in child object differs")
require.Equal(t, srcObj, w.Object())
require.Error(t, err)
require.Equal(t, err.Error(), "parent address in child object differs")
w = NewSimpleObjectWriter()
payloadSz := srcObj.PayloadSize()
@ -1479,9 +1477,8 @@ func TestGetRemoteSmall(t *testing.T) {
rngPrm.WithAddress(addr)
err = svc.GetRange(ctx, rngPrm)
require.NoError(t, err) //TODO fix me, it must be an error, corrupted chain
//require.Equal(t, err.Error(), "parent address in child object differs")
require.Equal(t, payload[off:off+ln], w.Object().Payload())
require.Error(t, err)
require.Equal(t, err.Error(), "parent address in child object differs")
})
t.Run("OK", func(t *testing.T) {