fix require-error rule from testifylint

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-06-01 21:44:09 +02:00
parent 3024e6223e
commit 07ea14962c
99 changed files with 483 additions and 440 deletions

View File

@@ -51,7 +51,7 @@ func TestIsHostPathVolume(t *testing.T) {
},
}
isHostPath, err := isHostPathVolume(vol, nil, nil)
assert.NoError(t, err)
require.NoError(t, err)
assert.True(t, isHostPath)
// non-hostPath pod volume
@@ -61,7 +61,7 @@ func TestIsHostPathVolume(t *testing.T) {
},
}
isHostPath, err = isHostPathVolume(vol, nil, nil)
assert.NoError(t, err)
require.NoError(t, err)
assert.False(t, isHostPath)
// PVC that doesn't have a PV
@@ -79,7 +79,7 @@ func TestIsHostPathVolume(t *testing.T) {
},
}
isHostPath, err = isHostPathVolume(vol, pvc, nil)
assert.NoError(t, err)
require.NoError(t, err)
assert.False(t, isHostPath)
// PVC that claims a non-hostPath PV
@@ -107,7 +107,7 @@ func TestIsHostPathVolume(t *testing.T) {
}
crClient1 := velerotest.NewFakeControllerRuntimeClient(t, pv)
isHostPath, err = isHostPathVolume(vol, pvc, crClient1)
assert.NoError(t, err)
require.NoError(t, err)
assert.False(t, isHostPath)
// PVC that claims a hostPath PV
@@ -140,7 +140,7 @@ func TestIsHostPathVolume(t *testing.T) {
crClient2 := velerotest.NewFakeControllerRuntimeClient(t, pv)
isHostPath, err = isHostPathVolume(vol, pvc, crClient2)
assert.NoError(t, err)
require.NoError(t, err)
assert.True(t, isHostPath)
}
@@ -588,10 +588,10 @@ func TestBackupPodVolumes(t *testing.T) {
pvbs, _, errs := bp.BackupPodVolumes(backupObj, test.sourcePod, test.volumes, nil, velerotest.NewLogger())
if test.errs == nil {
assert.NoError(t, err)
require.NoError(t, err)
} else {
for i := 0; i < len(errs); i++ {
assert.EqualError(t, errs[i], test.errs[i])
require.EqualError(t, errs[i], test.errs[i])
}
}