Make webhook benchmarks parallel

This commit is contained in:
Jordan Liggitt 2019-08-28 13:27:38 -04:00
parent 8b4fd4104d
commit 601b7d33a9
2 changed files with 10 additions and 6 deletions

View File

@ -96,10 +96,12 @@ func BenchmarkAdmit(b *testing.B) {
} }
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
wh.Admit(context.TODO(), attr, objectInterfaces) wh.Admit(context.TODO(), attr, objectInterfaces)
} }
}) })
})
} }
} }

View File

@ -85,10 +85,12 @@ func BenchmarkValidate(b *testing.B) {
attr := webhooktesting.NewAttribute(ns, nil, tt.IsDryRun) attr := webhooktesting.NewAttribute(ns, nil, tt.IsDryRun)
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
wh.Validate(context.TODO(), attr, objectInterfaces) wh.Validate(context.TODO(), attr, objectInterfaces)
} }
}) })
})
} }
} }