From 29a77958d552e2dc30777b4bd41514f2464564b1 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Fri, 10 Jan 2025 11:44:06 +0100 Subject: [PATCH] fix: dupword on tests Signed-off-by: Matthieu MOREL --- .golangci.yaml | 10 ++++++-- .../delete/delete_item_action_handler_test.go | 2 +- pkg/restore/restore_test.go | 4 +-- pkg/util/csi/volume_snapshot_test.go | 8 +++--- test/util/velero/velero_utils.go | 25 +++++++++---------- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index dff2bdfeb..79ad89a81 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -338,7 +338,6 @@ issues: text: "DefaultVolumesToRestic" # No need to report deprecate for DefaultVolumesToRestic. - path: ".*_test.go$" linters: - - dupword - errcheck - goconst - gosec @@ -349,7 +348,6 @@ issues: - unused - path: test/ linters: - - dupword - errcheck - goconst - gosec @@ -358,6 +356,14 @@ issues: - stylecheck - unparam - unused + - path: data_upload_controller_test.go + linters: + - dupword + text: "Duplicate words (type)" + - path: config_test.go + linters: + - dupword + text: "Duplicate words (bucket:)" # The list of ids of default excludes to include or disable. By default it's empty. include: diff --git a/internal/delete/delete_item_action_handler_test.go b/internal/delete/delete_item_action_handler_test.go index 8bd120602..a71de864d 100644 --- a/internal/delete/delete_item_action_handler_test.go +++ b/internal/delete/delete_item_action_handler_test.go @@ -230,7 +230,7 @@ func (h *harness) addResource(t *testing.T, resource *test.APIResource) { } // recordResourcesAction is a delete item action that can be configured to run -// for specific resources/namespaces and simply record the items that is is +// for specific resources/namespaces and simply record the items that is // executed for. type recordResourcesAction struct { selector velero.ResourceSelector diff --git a/pkg/restore/restore_test.go b/pkg/restore/restore_test.go index f3da85202..065d23cbe 100644 --- a/pkg/restore/restore_test.go +++ b/pkg/restore/restore_test.go @@ -1709,7 +1709,7 @@ func (a *pluggableAction) AreAdditionalItemsReady(additionalItems []velero.Resou } // TestRestoreActionModifications runs restores with restore item actions that modify resources, and -// verifies that that the modified item is correctly created in the API. Verification is done by looking +// verifies that the modified item is correctly created in the API. Verification is done by looking // at the full object in the API. func TestRestoreActionModifications(t *testing.T) { // modifyingActionGetter is a helper function that returns a *pluggableAction, whose Execute(...) @@ -2006,7 +2006,7 @@ func TestRestoreWithAsyncOperations(t *testing.T) { } // TestRestoreActionAdditionalItems runs restores with restore item actions that return additional items -// to be restored, and verifies that that the correct set of items is created in the API. Verification is +// to be restored, and verifies that the correct set of items is created in the API. Verification is // done by looking at the namespaces/names of the items in the API; contents are not checked. func TestRestoreActionAdditionalItems(t *testing.T) { tests := []struct { diff --git a/pkg/util/csi/volume_snapshot_test.go b/pkg/util/csi/volume_snapshot_test.go index 29a34feed..e5a87c2bd 100644 --- a/pkg/util/csi/volume_snapshot_test.go +++ b/pkg/util/csi/volume_snapshot_test.go @@ -1684,28 +1684,28 @@ func TestWaitUntilVSCHandleIsReady(t *testing.T) { }, }, { - name: "waitDisabled should not find volumesnapshotcontent volumesnapshot status is nil", + name: "waitDisabled should not find volumesnapshotcontent when volumesnapshot status is nil", wait: false, expectError: false, exepctedVSC: nil, volSnap: vsWithNilStatus, }, { - name: "waitDisabled should not find volumesnapshotcontent volumesnapshot status.BoundVolumeSnapshotContentName is nil", + name: "waitDisabled should not find volumesnapshotcontent when volumesnapshot status.BoundVolumeSnapshotContentName is nil", wait: false, expectError: false, exepctedVSC: nil, volSnap: vsWithNilStatusField, }, { - name: "waitDisabled should find volumesnapshotcontent volumesnapshotcontent status is nil", + name: "waitDisabled should find volumesnapshotcontent when volumesnapshotcontent status is nil", wait: false, expectError: false, exepctedVSC: vscWithNilStatus, volSnap: vsForNilStatusVsc, }, { - name: "waitDisabled should find volumesnapshotcontent volumesnapshotcontent status.SnapshotHandle is nil", + name: "waitDisabled should find volumesnapshotcontent when volumesnapshotcontent status.SnapshotHandle is nil", wait: false, expectError: false, exepctedVSC: vscWithNilStatusField, diff --git a/test/util/velero/velero_utils.go b/test/util/velero/velero_utils.go index c57ceae4c..d799df9f7 100644 --- a/test/util/velero/velero_utils.go +++ b/test/util/velero/velero_utils.go @@ -786,19 +786,18 @@ func WaitForVSphereUploadCompletion(ctx context.Context, timeout time.Duration, for _, curLine := range lines { fmt.Printf("%s %s\n", curLine, time.Now().Format("2006-01-02 15:04:05")) comps := strings.Split(curLine, "=") - // SnapshotPhase represents the lifecycle phase of a Snapshot. - // New - No work yet, next phase is InProgress - // InProgress - snapshot being taken - // Snapshotted - local snapshot complete, next phase is Protecting or SnapshotFailed - // SnapshotFailed - end state, snapshot was not able to be taken - // Uploading - snapshot is being moved to durable storage - // Uploaded - end state, snapshot has been protected - // UploadFailed - end state, unable to move to durable storage - // Canceling - when the SanpshotCancel flag is set, if the Snapshot has not already moved into a terminal state, the - // status will move to Canceling. The snapshot ID will be removed from the status status if has been filled in - // and the snapshot ID will not longer be valid for a Clone operation - // Canceled - the operation was canceled, the snapshot ID is not valid - // Canceled - the operation was canceled, the snapshot ID is not valid + // SnapshotPhase represents the lifecycle phase of a Snapshot: + // * New: No work yet, next phase is InProgress + // * InProgress: snapshot being taken + // * Snapshotted: local snapshot complete, next phase is Protecting or SnapshotFailed + // * SnapshotFailed: end state, snapshot was not able to be taken + // * Uploading: snapshot is being moved to durable storage + // * Uploaded: end state, snapshot has been protected + // * UploadFailed: end state, unable to move to durable storage + // * Canceling: when the SanpshotCancel flag is set, if the Snapshot has not already moved into a terminal state, the + // status will move to Canceling. The snapshot ID will be removed from the status if the status has been filled in + // and the snapshot ID will not longer be valid for a Clone operation + // * Canceled: the operation was canceled, the snapshot ID is not valid if len(comps) == 2 { phase := comps[1] actualCount++