mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
apiserver: update tests to use sub-benchmarks (secretbox_test.go)
This commit is contained in:
parent
15cd355281
commit
6647b92c86
@ -77,12 +77,39 @@ func TestSecretboxKeyRotation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkSecretboxRead_32_1024(b *testing.B) { benchmarkSecretboxRead(b, 32, 1024, false) }
|
func BenchmarkSecretboxRead(b *testing.B) {
|
||||||
func BenchmarkSecretboxRead_32_16384(b *testing.B) { benchmarkSecretboxRead(b, 32, 16384, false) }
|
tests := []struct {
|
||||||
func BenchmarkSecretboxRead_32_16384_Stale(b *testing.B) { benchmarkSecretboxRead(b, 32, 16384, true) }
|
keyLength int
|
||||||
|
valueLength int
|
||||||
|
expectStale bool
|
||||||
|
}{
|
||||||
|
{keyLength: 32, valueLength: 1024, expectStale: false},
|
||||||
|
{keyLength: 32, valueLength: 16384, expectStale: false},
|
||||||
|
{keyLength: 32, valueLength: 16384, expectStale: true},
|
||||||
|
}
|
||||||
|
for _, t := range tests {
|
||||||
|
name := fmt.Sprintf("%vKeyLength/%vValueLength/%vExpectStale", t.keyLength, t.valueLength, t.expectStale)
|
||||||
|
b.Run(name, func(b *testing.B) {
|
||||||
|
benchmarkSecretboxRead(b, t.keyLength, t.valueLength, t.expectStale)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkSecretboxWrite_32_1024(b *testing.B) { benchmarkSecretboxWrite(b, 32, 1024) }
|
func BenchmarkSecretboxWrite(b *testing.B) {
|
||||||
func BenchmarkSecretboxWrite_32_16384(b *testing.B) { benchmarkSecretboxWrite(b, 32, 16384) }
|
tests := []struct {
|
||||||
|
keyLength int
|
||||||
|
valueLength int
|
||||||
|
}{
|
||||||
|
{keyLength: 32, valueLength: 1024},
|
||||||
|
{keyLength: 32, valueLength: 16384},
|
||||||
|
}
|
||||||
|
for _, t := range tests {
|
||||||
|
name := fmt.Sprintf("%vKeyLength/%vValueLength", t.keyLength, t.valueLength)
|
||||||
|
b.Run(name, func(b *testing.B) {
|
||||||
|
benchmarkSecretboxWrite(b, t.keyLength, t.valueLength)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func benchmarkSecretboxRead(b *testing.B, keyLength int, valueLength int, expectStale bool) {
|
func benchmarkSecretboxRead(b *testing.B, keyLength int, valueLength int, expectStale bool) {
|
||||||
p := value.NewPrefixTransformers(nil,
|
p := value.NewPrefixTransformers(nil,
|
||||||
|
Loading…
Reference in New Issue
Block a user