testifylint: enable error-nil rule (#7670)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2024-07-16 18:23:16 +02:00
committed by GitHub
parent aa3fde5ea5
commit 35c90f1672
58 changed files with 218 additions and 219 deletions

View File

@@ -669,7 +669,7 @@ func TestGetPodVolumeNameForPVC(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
actualVolumeName, err := getPodVolumeNameForPVC(tc.pod, tc.pvcName)
if tc.expectError && err == nil {
assert.NotNil(t, err, "Want error; Got nil error")
assert.Error(t, err, "Want error; Got nil error")
return
}
assert.Equalf(t, tc.expectedVolumeName, actualVolumeName, "unexpected podVolumename returned. Want %s; Got %s", tc.expectedVolumeName, actualVolumeName)
@@ -787,7 +787,7 @@ func TestGetPodsUsingPVC(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
actualPods, err := GetPodsUsingPVC(tc.pvcNamespace, tc.pvcName, fakeClient)
assert.Nilf(t, err, "Want error=nil; Got error=%v", err)
assert.NoErrorf(t, err, "Want error=nil; Got error=%v", err)
assert.Lenf(t, actualPods, tc.expectedPodCount, "unexpected number of pods in result; Want: %d; Got: %d", tc.expectedPodCount, len(actualPods))
})
}