mirror of https://github.com/docker/cli.git
github.com/docker/cli/cli/command/system: add BenchmarkPrettyPrintInfo
goos: linux goarch: arm64 pkg: github.com/docker/cli/cli/command/system BenchmarkPrettyPrintInfo BenchmarkPrettyPrintInfo-5 189028 6156 ns/op 1776 B/op 88 allocs/op Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
afd320c5ab
commit
416e55bedb
|
@ -419,6 +419,30 @@ func TestPrettyPrintInfo(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkPrettyPrintInfo(b *testing.B) {
|
||||||
|
infoWithSwarm := sampleInfoNoSwarm
|
||||||
|
infoWithSwarm.Swarm = sampleSwarmInfo
|
||||||
|
|
||||||
|
dockerInfo := info{
|
||||||
|
Info: &infoWithSwarm,
|
||||||
|
ClientInfo: &clientInfo{
|
||||||
|
clientVersion: clientVersion{
|
||||||
|
Platform: &platformInfo{Name: "Docker Engine - Community"},
|
||||||
|
Version: "24.0.0",
|
||||||
|
Context: "default",
|
||||||
|
},
|
||||||
|
Debug: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
cli := test.NewFakeCli(&fakeClient{})
|
||||||
|
|
||||||
|
b.ReportAllocs()
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
_ = prettyPrintInfo(cli, dockerInfo)
|
||||||
|
cli.ResetOutputBuffers()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestFormatInfo(t *testing.T) {
|
func TestFormatInfo(t *testing.T) {
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
doc string
|
doc string
|
||||||
|
|
Loading…
Reference in New Issue