From 772c8be200b6d0e6bdcfedfb8bd5cfdedd8e9848 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 14:58:32 +0300 Subject: [PATCH] [#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 --- v2/audit/test/generate.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/v2/audit/test/generate.go b/v2/audit/test/generate.go index 76d85a91..0d5ff01e 100644 --- a/v2/audit/test/generate.go +++ b/v2/audit/test/generate.go @@ -19,12 +19,11 @@ func GenerateDataAuditResult(empty bool) *audit.DataAuditResult { m.SetFailNodes([][]byte{{3}, {4}}) m.SetRequests(666) 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 }