From 98a1db8daae682ff1968fde2e15526a98bc5c7b1 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 5 Jan 2022 21:39:09 +0800 Subject: [PATCH] fix: change variable name --- internal/boomer/stats.go | 6 +++--- internal/boomer/stats_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/boomer/stats.go b/internal/boomer/stats.go index 24141005..53b4f707 100644 --- a/internal/boomer/stats.go +++ b/internal/boomer/stats.go @@ -86,7 +86,7 @@ func (s *requestStats) logError(method, name, err string) { entry = &statsError{ name: name, method: method, - error: err, + errMsg: err, } s.errors[key] = entry } @@ -296,7 +296,7 @@ func (s *statsEntry) getStrippedReport() map[string]interface{} { type statsError struct { name string method string - error string + errMsg string occurrences int64 } @@ -308,7 +308,7 @@ func (err *statsError) toMap() map[string]interface{} { m := make(map[string]interface{}) m["method"] = err.method m["name"] = err.name - m["error"] = err.error + m["error"] = err.errMsg m["occurrences"] = err.occurrences return m } diff --git a/internal/boomer/stats_test.go b/internal/boomer/stats_test.go index 666a9636..afe0b41e 100644 --- a/internal/boomer/stats_test.go +++ b/internal/boomer/stats_test.go @@ -95,8 +95,8 @@ func TestLogError(t *testing.T) { // md5("httpfailure500 error") = 547c38e4e4742c1c581f9e2809ba4f55 err500 := newStats.errors["547c38e4e4742c1c581f9e2809ba4f55"] - if err500.error != "500 error" { - t.Error("Error message is wrong, expected: 500 error, got:", err500.error) + if err500.errMsg != "500 error" { + t.Error("Error message is wrong, expected: 500 error, got:", err500.errMsg) } if err500.occurrences != 1 { t.Error("Error occurrences is wrong, expected: 1, got:", err500.occurrences) @@ -104,8 +104,8 @@ func TestLogError(t *testing.T) { // md5("httpfailure400 error") = f391c310401ad8e10e929f2ee1a614e4 err400 := newStats.errors["f391c310401ad8e10e929f2ee1a614e4"] - if err400.error != "400 error" { - t.Error("Error message is wrong, expected: 400 error, got:", err400.error) + if err400.errMsg != "400 error" { + t.Error("Error message is wrong, expected: 400 error, got:", err400.errMsg) } if err400.occurrences != 2 { t.Error("Error occurrences is wrong, expected: 2, got:", err400.occurrences)