From 406501e20c8cab3bf30789a8a9cc24410c4227d5 Mon Sep 17 00:00:00 2001 From: nakabonne Date: Thu, 1 Oct 2020 17:06:26 +0900 Subject: [PATCH] Fix layout of metrics --- gui/drawer.go | 18 +++++++++--------- gui/drawer_test.go | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gui/drawer.go b/gui/drawer.go index 40dd61a..f49fdff 100644 --- a/gui/drawer.go +++ b/gui/drawer.go @@ -90,15 +90,15 @@ Out: Total: %v Mean: %v` - othersTextFormat = `Earliest: %v -Latest: %v -End: %v -Duration: %v + othersTextFormat = `Duration: %v Wait: %v Requests: %d Rate: %f Throughput: %f -Success: %f` +Success: %f +Earliest: %v +Latest: %v +End: %v` ) func (d *drawer) redrawMetrics(ctx context.Context) { @@ -132,20 +132,20 @@ func (d *drawer) redrawMetrics(ctx context.Context) { ), text.WriteReplace()) d.widgets.othersText.Write(fmt.Sprintf(othersTextFormat, - metrics.Earliest, - metrics.Latest, - metrics.End, metrics.Duration, metrics.Wait, metrics.Requests, metrics.Rate, metrics.Throughput, metrics.Success, + metrics.Earliest, + metrics.Latest, + metrics.End, ), text.WriteReplace()) codesText := "" for code, n := range metrics.StatusCodes { - codesText += fmt.Sprintf(`%s: %d + codesText += fmt.Sprintf(`%q: %d `, code, n) } d.widgets.statusCodesText.Write(codesText, text.WriteReplace()) diff --git a/gui/drawer_test.go b/gui/drawer_test.go index d337d60..d5f797d 100644 --- a/gui/drawer_test.go +++ b/gui/drawer_test.go @@ -216,7 +216,7 @@ Out: statusCodesText: func() Text { t := NewMockText(ctrl) - t.EXPECT().Write(`200: 2 + t.EXPECT().Write(`"200": 2 `, gomock.Any()) return t }(), @@ -230,15 +230,15 @@ Out: othersText: func() Text { t := NewMockText(ctrl) - t.EXPECT().Write(`Earliest: 2009-11-10 23:00:00 +0000 UTC -Latest: 2009-11-10 23:00:00 +0000 UTC -End: 2009-11-10 23:00:00 +0000 UTC -Duration: 1ns + t.EXPECT().Write(`Duration: 1ns Wait: 1ns Requests: 1 Rate: 1.000000 Throughput: 1.000000 -Success: 1.000000`, gomock.Any()) +Success: 1.000000 +Earliest: 2009-11-10 23:00:00 +0000 UTC +Latest: 2009-11-10 23:00:00 +0000 UTC +End: 2009-11-10 23:00:00 +0000 UTC`, gomock.Any()) return t }(),