Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
19026bf9
Commit
19026bf9
authored
May 27, 2018
by
Yang Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apiserver: update tests to use sub-benchmarks (aes_test.go)
parent
99ebcd94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
12 deletions
+66
-12
aes_test.go
...8s.io/apiserver/pkg/storage/value/encrypt/aes/aes_test.go
+66
-12
No files found.
staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/aes/aes_test.go
View file @
19026bf9
...
@@ -149,14 +149,41 @@ func TestCBCKeyRotation(t *testing.T) {
...
@@ -149,14 +149,41 @@ func TestCBCKeyRotation(t *testing.T) {
}
}
}
}
func
BenchmarkGCMRead_16_1024
(
b
*
testing
.
B
)
{
benchmarkGCMRead
(
b
,
16
,
1024
,
false
)
}
func
BenchmarkGCMRead
(
b
*
testing
.
B
)
{
func
BenchmarkGCMRead_32_1024
(
b
*
testing
.
B
)
{
benchmarkGCMRead
(
b
,
32
,
1024
,
false
)
}
tests
:=
[]
struct
{
func
BenchmarkGCMRead_32_16384
(
b
*
testing
.
B
)
{
benchmarkGCMRead
(
b
,
32
,
16384
,
false
)
}
keyLength
int
func
BenchmarkGCMRead_32_16384_Stale
(
b
*
testing
.
B
)
{
benchmarkGCMRead
(
b
,
32
,
16384
,
true
)
}
valueLength
int
expectStale
bool
}{
{
keyLength
:
16
,
valueLength
:
1024
,
expectStale
:
false
},
{
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
)
{
benchmarkGCMRead
(
b
,
t
.
keyLength
,
t
.
valueLength
,
t
.
expectStale
)
})
}
}
func
BenchmarkGCMWrite_16_1024
(
b
*
testing
.
B
)
{
benchmarkGCMWrite
(
b
,
16
,
1024
)
}
func
BenchmarkGCMWrite
(
b
*
testing
.
B
)
{
func
BenchmarkGCMWrite_32_1024
(
b
*
testing
.
B
)
{
benchmarkGCMWrite
(
b
,
32
,
1024
)
}
tests
:=
[]
struct
{
func
BenchmarkGCMWrite_32_16384
(
b
*
testing
.
B
)
{
benchmarkGCMWrite
(
b
,
32
,
16384
)
}
keyLength
int
valueLength
int
}{
{
keyLength
:
16
,
valueLength
:
1024
},
{
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
)
{
benchmarkGCMWrite
(
b
,
t
.
keyLength
,
t
.
valueLength
)
})
}
}
func
benchmarkGCMRead
(
b
*
testing
.
B
,
keyLength
int
,
valueLength
int
,
expectStale
bool
)
{
func
benchmarkGCMRead
(
b
*
testing
.
B
,
keyLength
int
,
valueLength
int
,
expectStale
bool
)
{
block1
,
err
:=
aes
.
NewCipher
(
bytes
.
Repeat
([]
byte
(
"a"
),
keyLength
))
block1
,
err
:=
aes
.
NewCipher
(
bytes
.
Repeat
([]
byte
(
"a"
),
keyLength
))
...
@@ -227,12 +254,39 @@ func benchmarkGCMWrite(b *testing.B, keyLength int, valueLength int) {
...
@@ -227,12 +254,39 @@ func benchmarkGCMWrite(b *testing.B, keyLength int, valueLength int) {
b
.
StopTimer
()
b
.
StopTimer
()
}
}
func
BenchmarkCBCRead_32_1024
(
b
*
testing
.
B
)
{
benchmarkCBCRead
(
b
,
32
,
1024
,
false
)
}
func
BenchmarkCBCRead
(
b
*
testing
.
B
)
{
func
BenchmarkCBCRead_32_16384
(
b
*
testing
.
B
)
{
benchmarkCBCRead
(
b
,
32
,
16384
,
false
)
}
tests
:=
[]
struct
{
func
BenchmarkCBCRead_32_16384_Stale
(
b
*
testing
.
B
)
{
benchmarkCBCRead
(
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
)
{
benchmarkCBCRead
(
b
,
t
.
keyLength
,
t
.
valueLength
,
t
.
expectStale
)
})
}
}
func
BenchmarkCBCWrite_32_1024
(
b
*
testing
.
B
)
{
benchmarkCBCWrite
(
b
,
32
,
1024
)
}
func
BenchmarkCBCWrite
(
b
*
testing
.
B
)
{
func
BenchmarkCBCWrite_32_16384
(
b
*
testing
.
B
)
{
benchmarkCBCWrite
(
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
)
{
benchmarkCBCWrite
(
b
,
t
.
keyLength
,
t
.
valueLength
)
})
}
}
func
benchmarkCBCRead
(
b
*
testing
.
B
,
keyLength
int
,
valueLength
int
,
expectStale
bool
)
{
func
benchmarkCBCRead
(
b
*
testing
.
B
,
keyLength
int
,
valueLength
int
,
expectStale
bool
)
{
block1
,
err
:=
aes
.
NewCipher
(
bytes
.
Repeat
([]
byte
(
"a"
),
keyLength
))
block1
,
err
:=
aes
.
NewCipher
(
bytes
.
Repeat
([]
byte
(
"a"
),
keyLength
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment