[#307] v2/audit/test: Do not allocate memory if !empty

Move all memory allocation and field settings
in `Generate...(empty bool)` functions behind
`if !empty` check.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-06-11 14:58:32 +03:00 committed by Alex Vanin
parent e15dd105fe
commit 772c8be200

View file

@ -19,12 +19,11 @@ func GenerateDataAuditResult(empty bool) *audit.DataAuditResult {
m.SetFailNodes([][]byte{{3}, {4}}) m.SetFailNodes([][]byte{{3}, {4}})
m.SetRequests(666) m.SetRequests(666)
m.SetRetries(777) m.SetRetries(777)
m.SetVersion(refstest.GenerateVersion(false))
m.SetContainerID(refstest.GenerateContainerID(false))
m.SetPassSG(refstest.GenerateObjectIDs(false))
m.SetFailSG(refstest.GenerateObjectIDs(false))
} }
m.SetVersion(refstest.GenerateVersion(empty))
m.SetContainerID(refstest.GenerateContainerID(empty))
m.SetPassSG(refstest.GenerateObjectIDs(empty))
m.SetFailSG(refstest.GenerateObjectIDs(empty))
return m return m
} }