Skip to content

Commit 416e55b

Browse files
committed
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>
1 parent afd320c commit 416e55b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

cli/command/system/info_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,30 @@ func TestPrettyPrintInfo(t *testing.T) {
419419
}
420420
}
421421

422+
func BenchmarkPrettyPrintInfo(b *testing.B) {
423+
infoWithSwarm := sampleInfoNoSwarm
424+
infoWithSwarm.Swarm = sampleSwarmInfo
425+
426+
dockerInfo := info{
427+
Info: &infoWithSwarm,
428+
ClientInfo: &clientInfo{
429+
clientVersion: clientVersion{
430+
Platform: &platformInfo{Name: "Docker Engine - Community"},
431+
Version: "24.0.0",
432+
Context: "default",
433+
},
434+
Debug: true,
435+
},
436+
}
437+
cli := test.NewFakeCli(&fakeClient{})
438+
439+
b.ReportAllocs()
440+
for i := 0; i < b.N; i++ {
441+
_ = prettyPrintInfo(cli, dockerInfo)
442+
cli.ResetOutputBuffers()
443+
}
444+
}
445+
422446
func TestFormatInfo(t *testing.T) {
423447
for _, tc := range []struct {
424448
doc string

0 commit comments

Comments
 (0)