testifylint: enable compares rule

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
pull/7671/head
Matthieu MOREL 2024-04-14 20:15:33 +00:00
parent a0b7382e5a
commit 1010b04821
4 changed files with 7 additions and 11 deletions

View File

@ -239,7 +239,6 @@ linters-settings:
# TODO: enable them all # TODO: enable them all
disable: disable:
- bool-compare - bool-compare
- compares
- error-is-as - error-is-as
- error-nil - error-nil
- expected-actual - expected-actual
@ -249,10 +248,7 @@ linters-settings:
- suite-dont-use-pkg - suite-dont-use-pkg
- suite-extra-assert-call - suite-extra-assert-call
- suite-thelper - suite-thelper
enable: enable-all: true
- empty
- len
- nil-compare
testpackage: testpackage:
# regexp pattern to skip files # regexp pattern to skip files
skip-regexp: (export|internal)_test\.go skip-regexp: (export|internal)_test\.go

View File

@ -3439,7 +3439,7 @@ func assertTarballOrdering(t *testing.T, backupFile io.Reader, orderedResources
// get the resource name // get the resource name
parts := strings.Split(hdr.Name, "/") parts := strings.Split(hdr.Name, "/")
require.True(t, len(parts) >= 2) require.GreaterOrEqual(t, len(parts), 2)
resourceName := parts[1] resourceName := parts[1]
// Find the index in 'orderedResources' of the resource type for // Find the index in 'orderedResources' of the resource type for
@ -3459,7 +3459,7 @@ func assertTarballOrdering(t *testing.T, backupFile io.Reader, orderedResources
// the index of the current resource must be the same as or greater than the index of // the index of the current resource must be the same as or greater than the index of
// the last resource we saw for the backed-up order to be correct. // the last resource we saw for the backed-up order to be correct.
assert.True(t, current >= lastSeen, "%s was backed up out of order", resourceName) assert.GreaterOrEqual(t, current, lastSeen, "%s was backed up out of order", resourceName)
lastSeen = current lastSeen = current
} }
} }

View File

@ -571,11 +571,11 @@ func TestDefaultVolumesToResticDeprecation(t *testing.T) {
if test.expectRemap { if test.expectRemap {
assert.Equal(t, res.Spec.DefaultVolumesToRestic, res.Spec.DefaultVolumesToFsBackup) assert.Equal(t, res.Spec.DefaultVolumesToRestic, res.Spec.DefaultVolumesToFsBackup)
} else if test.expectGlobal { } else if test.expectGlobal {
assert.False(t, res.Spec.DefaultVolumesToRestic == res.Spec.DefaultVolumesToFsBackup) assert.NotSame(t, res.Spec.DefaultVolumesToRestic, res.Spec.DefaultVolumesToFsBackup)
assert.Equal(t, &c.defaultVolumesToFsBackup, res.Spec.DefaultVolumesToFsBackup) assert.Equal(t, &c.defaultVolumesToFsBackup, res.Spec.DefaultVolumesToFsBackup)
} else { } else {
assert.False(t, res.Spec.DefaultVolumesToRestic == res.Spec.DefaultVolumesToFsBackup) assert.NotSame(t, res.Spec.DefaultVolumesToRestic, res.Spec.DefaultVolumesToFsBackup)
assert.False(t, &c.defaultVolumesToFsBackup == res.Spec.DefaultVolumesToFsBackup) assert.NotEqual(t, &c.defaultVolumesToFsBackup, res.Spec.DefaultVolumesToFsBackup)
} }
assert.Equal(t, test.expectVal, *res.Spec.DefaultVolumesToFsBackup) assert.Equal(t, test.expectVal, *res.Spec.DefaultVolumesToFsBackup)

View File

@ -3598,7 +3598,7 @@ func assertResourceCreationOrder(t *testing.T, resourcePriorities []string, crea
// the index of the current resource must be the same as or greater than the index of // the index of the current resource must be the same as or greater than the index of
// the last resource we saw for the restored order to be correct. // the last resource we saw for the restored order to be correct.
assert.True(t, current >= lastSeen, "%s was restored out of order", r.groupResource) assert.GreaterOrEqual(t, current, lastSeen, "%s was restored out of order", r.groupResource)
lastSeen = current lastSeen = current
} }
} }