From cff053b74afce2c6b6b6fcae97e8247b72822da5 Mon Sep 17 00:00:00 2001 From: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Date: Mon, 10 Apr 2023 13:40:45 -0500 Subject: [PATCH] Fixed code review comments. Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --- .golangci.yml | 1 - checker/check_request_test.go | 2 ++ checker/check_result_test.go | 23 +++++++++++++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 3c4765db6f5b..80a62880379f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,7 +17,6 @@ issues: linters: - funlen - goconst - - govet - gocyclo skip-files: - cron/data/request.pb.go # autogenerated diff --git a/checker/check_request_test.go b/checker/check_request_test.go index 4056ebca5024..0db006cc7ecd 100644 --- a/checker/check_request_test.go +++ b/checker/check_request_test.go @@ -56,6 +56,7 @@ func TestListUnsupported(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := ListUnsupported(tt.args.required, tt.args.supported); cmp.Equal(got, tt.want) { @@ -110,6 +111,7 @@ func Test_contains(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := contains(tt.args.in, tt.args.exists); got != tt.want { diff --git a/checker/check_result_test.go b/checker/check_result_test.go index 1d1525c7def9..4d8a54673c80 100644 --- a/checker/check_result_test.go +++ b/checker/check_result_test.go @@ -54,6 +54,7 @@ func TestAggregateScores(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := AggregateScores(tt.args.scores...); got != tt.want { //nolint:govet @@ -96,6 +97,7 @@ func TestAggregateScoresWithWeight(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := AggregateScoresWithWeight(tt.args.scores); got != tt.want { //nolint:govet @@ -141,6 +143,7 @@ func TestCreateProportionalScore(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := CreateProportionalScore(tt.args.success, tt.args.total); got != tt.want { //nolint:govet @@ -179,6 +182,7 @@ func TestNormalizeReason(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := NormalizeReason(tt.args.reason, tt.args.score); got != tt.want { //nolint:govet @@ -208,9 +212,10 @@ func TestCreateResultWithScore(t *testing.T) { score: 0, }, want: CheckResult{ - Name: "", - Reason: "", - Score: 0, + Name: "", + Reason: "", + Score: 0, + Version: 2, }, }, { @@ -229,6 +234,7 @@ func TestCreateResultWithScore(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := CreateResultWithScore(tt.args.name, tt.args.reason, tt.args.score); !cmp.Equal(got, tt.want) { //nolint:lll,govet @@ -283,6 +289,7 @@ func TestCreateProportionalScoreResult(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := CreateProportionalScoreResult(tt.args.name, tt.args.reason, tt.args.b, tt.args.t); !cmp.Equal(got, tt.want) { //nolint:govet,lll @@ -331,6 +338,7 @@ func TestCreateMaxScoreResult(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := CreateMaxScoreResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) { //nolint:govet @@ -379,9 +387,10 @@ func TestCreateMinScoreResult(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() - if got := CreateMinScoreResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) { + if got := CreateMinScoreResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) { //nolint:govet t.Errorf("CreateMinScoreResult() = %v, want %v", got, cmp.Diff(got, tt.want)) } }) @@ -427,6 +436,7 @@ func TestCreateInconclusiveResult(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := CreateInconclusiveResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) { @@ -463,10 +473,11 @@ func TestCreateRuntimeErrorResult(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() - if got := CreateRuntimeErrorResult(tt.args.name, tt.args.e); !reflect.DeepEqual(got, tt.want) { //nolint:govet - t.Errorf("CreateRuntimeErrorResult() = %v, want %v", got, cmp.Diff(got, tt.want)) //nolint:govet + if got := CreateRuntimeErrorResult(tt.args.name, tt.args.e); !reflect.DeepEqual(got, tt.want) { + t.Errorf("CreateRuntimeErrorResult() = %v, want %v", got, cmp.Diff(got, tt.want)) } }) }