Skip to content

Commit

Permalink
Merge pull request vmware-tanzu#7671 from mmorel-35/testifylint/compare
Browse files Browse the repository at this point in the history
testifylint: enable compares rule
  • Loading branch information
blackpiglet authored May 27, 2024
2 parents c8e252c + 1010b04 commit d9c9f77
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ linters-settings:
# TODO: enable them all
disable:
- bool-compare
- compares
- error-is-as
- error-nil
- expected-actual
Expand All @@ -249,10 +248,7 @@ linters-settings:
- suite-dont-use-pkg
- suite-extra-assert-call
- suite-thelper
enable:
- empty
- len
- nil-compare
enable-all: true
testpackage:
# regexp pattern to skip files
skip-regexp: (export|internal)_test\.go
Expand Down
4 changes: 2 additions & 2 deletions pkg/backup/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3496,7 +3496,7 @@ func assertTarballOrdering(t *testing.T, backupFile io.Reader, orderedResources

// get the resource name
parts := strings.Split(hdr.Name, "/")
require.True(t, len(parts) >= 2)
require.GreaterOrEqual(t, len(parts), 2)
resourceName := parts[1]

// Find the index in 'orderedResources' of the resource type for
Expand All @@ -3516,7 +3516,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 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
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/backup_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,11 @@ func TestDefaultVolumesToResticDeprecation(t *testing.T) {
if test.expectRemap {
assert.Equal(t, res.Spec.DefaultVolumesToRestic, res.Spec.DefaultVolumesToFsBackup)
} 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)
} else {
assert.False(t, res.Spec.DefaultVolumesToRestic == res.Spec.DefaultVolumesToFsBackup)
assert.False(t, &c.defaultVolumesToFsBackup == res.Spec.DefaultVolumesToFsBackup)
assert.NotSame(t, res.Spec.DefaultVolumesToRestic, res.Spec.DefaultVolumesToFsBackup)
assert.NotEqual(t, &c.defaultVolumesToFsBackup, res.Spec.DefaultVolumesToFsBackup)
}

assert.Equal(t, test.expectVal, *res.Spec.DefaultVolumesToFsBackup)
Expand Down
2 changes: 1 addition & 1 deletion pkg/restore/restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
}
}
Expand Down

0 comments on commit d9c9f77

Please sign in to comment.