From 70516a385ea44fb39c96edba89fd990180be3cc7 Mon Sep 17 00:00:00 2001 From: Yu-Lin Chen Date: Tue, 27 Aug 2024 07:41:42 +0000 Subject: [PATCH] align testCases variable name --- pkg/common/utils/utils_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/common/utils/utils_test.go b/pkg/common/utils/utils_test.go index 00d869ca1..0dbec3203 100644 --- a/pkg/common/utils/utils_test.go +++ b/pkg/common/utils/utils_test.go @@ -726,7 +726,7 @@ func TestGetApplicationIDFromPod(t *testing.T) { func TestCheckAppIdInPod(t *testing.T) { mismatchError := errors.New("pod has inconsistent application ID") - tests := []struct { + testCases := []struct { name string pod *v1.Pod expected error @@ -774,11 +774,11 @@ func TestCheckAppIdInPod(t *testing.T) { expected: mismatchError, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := CheckAppIdInPod(tt.pod) - if tt.expected != nil { - assert.ErrorContains(t, err, tt.expected.Error()) + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := CheckAppIdInPod(tc.pod) + if tc.expected != nil { + assert.ErrorContains(t, err, tc.expected.Error()) } else { assert.NilError(t, err) } @@ -788,7 +788,7 @@ func TestCheckAppIdInPod(t *testing.T) { func TestCheckQueueNameInPod(t *testing.T) { mismatchError := errors.New("pod has inconsistent queue name") - tests := []struct { + testCases := []struct { name string pod *v1.Pod expected error @@ -835,11 +835,11 @@ func TestCheckQueueNameInPod(t *testing.T) { expected: mismatchError, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := CheckQueueNameInPod(tt.pod) - if tt.expected != nil { - assert.ErrorContains(t, err, tt.expected.Error()) + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := CheckQueueNameInPod(tc.pod) + if tc.expected != nil { + assert.ErrorContains(t, err, tc.expected.Error()) } else { assert.NilError(t, err) }