Merge pull request #2166 from idealhack/tests-benchmark

test: update tests to use sub-benchmarks
This commit is contained in:
Flavio Crisciani 2018-07-03 14:06:58 -07:00 committed by GitHub
commit f857b5b8f8

View file

@ -1138,19 +1138,21 @@ func benchMarkRequest(subnet string, b *testing.B) {
}
}
func BenchmarkRequest_24(b *testing.B) {
a, _ := getAllocator(true)
benchmarkRequest(b, a, "10.0.0.0/24")
}
func BenchmarkRequest(b *testing.B) {
func BenchmarkRequest_16(b *testing.B) {
a, _ := getAllocator(true)
benchmarkRequest(b, a, "10.0.0.0/16")
}
subnets := []string{
"10.0.0.0/24",
"10.0.0.0/16",
"10.0.0.0/8",
}
func BenchmarkRequest_8(b *testing.B) {
a, _ := getAllocator(true)
benchmarkRequest(b, a, "10.0.0.0/8")
for _, subnet := range subnets {
name := fmt.Sprintf("%vSubnet", subnet)
b.Run(name, func(b *testing.B) {
a, _ := getAllocator(true)
benchmarkRequest(b, a, subnet)
})
}
}
func TestAllocateRandomDeallocate(t *testing.T) {