All checks were successful
* Add plugin option for protogen in Makefile * Fix the generator for the plugin in util/protogen * Erase convertable types, move helpful methods to gRPC protobufs * Erase helpers for convertations * Generate StableMarshlal/StableSize for protobufs by the protoc plugin Signed-off-by: Airat Arifullin a.arifullin@yadro.com
36 lines
734 B
Go
36 lines
734 B
Go
package acl_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
acl "git.frostfs.info/TrueCloudLab/aarifullin/v2/acl/grpc"
|
|
acltest "git.frostfs.info/TrueCloudLab/aarifullin/v2/acl/test"
|
|
)
|
|
|
|
func BenchmarkTable_StableMarshal(b *testing.B) {
|
|
const size = 4
|
|
|
|
tb := new(acl.EACLTable)
|
|
rs := acltest.GenerateRecords(true)
|
|
for i := range rs {
|
|
fs := make([]*acl.EACLRecord_Filter, size)
|
|
for j := range fs {
|
|
fs[j] = acltest.GenerateFilter(false)
|
|
}
|
|
ts := make([]*acl.EACLRecord_Target, size)
|
|
for j := range ts {
|
|
ts[j] = acltest.GenerateTarget(false)
|
|
}
|
|
|
|
rs[i].SetFilters(fs)
|
|
rs[i].SetTargets(ts)
|
|
}
|
|
tb.SetRecords(rs)
|
|
|
|
b.ReportAllocs()
|
|
for i := 0; i < b.N; i++ {
|
|
if len(tb.StableMarshal(nil)) != tb.StableSize() {
|
|
b.FailNow()
|
|
}
|
|
}
|
|
}
|