Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testifylint: enable and fix go-require rule #8236

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ linters-settings:
testifylint:
# TODO: enable them all
disable:
- go-require
- float-compare
- require-error
enable-all: true
Expand Down
9 changes: 5 additions & 4 deletions pkg/backup/actions/csi/pvc_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumesnapshot/v1"
v1 "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumesnapshot/v1"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
Expand Down Expand Up @@ -176,28 +177,28 @@ func TestExecute(t *testing.T) {
err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(ctx context.Context) (bool, error) {
err = pvcBIA.crClient.List(ctx, &vsList, &crclient.ListOptions{Namespace: tc.pvc.Namespace})

require.NoError(t, err)
assert.NoError(t, err)
if err != nil || len(vsList.Items) == 0 {
//lint:ignore nilerr reason
return false, nil // ignore
}
return true, nil
})

require.NoError(t, err)
assert.NoError(t, err)
vscName := "testVSC"
readyToUse := true
vsList.Items[0].Status = &v1.VolumeSnapshotStatus{
BoundVolumeSnapshotContentName: &vscName,
ReadyToUse: &readyToUse,
}
err = pvcBIA.crClient.Update(context.Background(), &vsList.Items[0])
require.NoError(t, err)
assert.NoError(t, err)

handleName := "testHandle"
vsc := builder.ForVolumeSnapshotContent("testVSC").Status(&snapshotv1api.VolumeSnapshotContentStatus{SnapshotHandle: &handleName}).Result()
err = pvcBIA.crClient.Create(context.Background(), vsc)
require.NoError(t, err)
assert.NoError(t, err)
}()
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/backup/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestNewLogsCommand(t *testing.T) {
done := make(chan bool)
go func() {
err = l.Run(c, f)
require.Error(t, err)
assert.Error(t, err)
}()

select {
Expand Down
Loading