forked from TrueCloudLab/frostfs-sdk-go
[#66] transformer: Extend tests
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
29b188db57
commit
c42a6119ff
2 changed files with 16 additions and 3 deletions
|
@ -81,10 +81,10 @@ func (s *payloadSizeLimiter) initialize() {
|
||||||
// initialize parent object once (after 1st object)
|
// initialize parent object once (after 1st object)
|
||||||
if ln == 1 {
|
if ln == 1 {
|
||||||
s.parent = fromObject(s.current)
|
s.parent = fromObject(s.current)
|
||||||
s.parentHashers = append(s.parentHashers[:0], s.currentHashers...)
|
s.parent.ResetRelations()
|
||||||
|
s.parent.SetSignature(nil)
|
||||||
// return source attributes
|
|
||||||
s.parent.SetAttributes(s.parAttrs...)
|
s.parent.SetAttributes(s.parAttrs...)
|
||||||
|
s.parentHashers = append(s.parentHashers[:0], s.currentHashers...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set previous object to the last previous identifier
|
// set previous object to the last previous identifier
|
||||||
|
|
|
@ -55,15 +55,28 @@ func TestTransformer(t *testing.T) {
|
||||||
require.Equal(t, h[:], cs.Value())
|
require.Equal(t, h[:], cs.Value())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require.True(t, tt.objects[i].VerifyIDSignature())
|
||||||
switch i {
|
switch i {
|
||||||
case 0, 1:
|
case 0, 1:
|
||||||
require.EqualValues(t, maxSize, len(payload))
|
require.EqualValues(t, maxSize, len(payload))
|
||||||
|
require.Nil(t, tt.objects[i].Parent())
|
||||||
case 2:
|
case 2:
|
||||||
require.EqualValues(t, maxSize/2, len(payload))
|
require.EqualValues(t, maxSize/2, len(payload))
|
||||||
|
parent := tt.objects[i].Parent()
|
||||||
|
require.NotNil(t, parent)
|
||||||
|
require.Nil(t, parent.SplitID())
|
||||||
|
require.True(t, parent.VerifyIDSignature())
|
||||||
case 3:
|
case 3:
|
||||||
parID, ok := tt.objects[i].ParentID()
|
parID, ok := tt.objects[i].ParentID()
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
require.Equal(t, ids.ParentID, &parID)
|
require.Equal(t, ids.ParentID, &parID)
|
||||||
|
|
||||||
|
children := tt.objects[i].Children()
|
||||||
|
for j := 0; j < i; j++ {
|
||||||
|
id, ok := tt.objects[j].ID()
|
||||||
|
require.True(t, ok)
|
||||||
|
require.Equal(t, id, children[j])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require.Equal(t, expectedPayload, actualPayload)
|
require.Equal(t, expectedPayload, actualPayload)
|
||||||
|
|
Loading…
Reference in a new issue