From 89f2ed1d041d2f555d646ee02b77c7e1dc2bda10 Mon Sep 17 00:00:00 2001 From: Alan Clucas Date: Wed, 14 Aug 2024 10:52:43 +0100 Subject: [PATCH] chore(lint): enable testifylint (#13467) Signed-off-by: Alan Clucas --- .golangci.yml | 1 + server/artifacts/artifact_server_test.go | 2 +- test/e2e/hooks_test.go | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 365742c9f4d1..76eb5794fa71 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -33,6 +33,7 @@ linters: - rowserrcheck - sqlclosecheck - staticcheck + - testifylint - typecheck - unparam - unused diff --git a/server/artifacts/artifact_server_test.go b/server/artifacts/artifact_server_test.go index 3501a1169f0e..9cc9edac8a9c 100644 --- a/server/artifacts/artifact_server_test.go +++ b/server/artifacts/artifact_server_test.go @@ -475,7 +475,7 @@ func TestArtifactServer_GetArtifactFile(t *testing.T) { if tt.isDirectory { fmt.Printf("got directory listing:\n%s\n", all) // verify that the files are contained in the listing we got back - assert.Equal(t, len(tt.directoryFiles), strings.Count(string(all), "
  • ")) + assert.Len(t, tt.directoryFiles, strings.Count(string(all), "
  • ")) for _, file := range tt.directoryFiles { assert.True(t, strings.Contains(string(all), file)) } diff --git a/test/e2e/hooks_test.go b/test/e2e/hooks_test.go index 8f36790becc0..a6442ab8b75e 100644 --- a/test/e2e/hooks_test.go +++ b/test/e2e/hooks_test.go @@ -813,12 +813,12 @@ spec: })). Then(). ExpectWorkflow(func(t *testing.T, metadata *v1.ObjectMeta, status *v1alpha1.WorkflowStatus) { - assert.Equal(t, status.Phase, v1alpha1.WorkflowFailed) + assert.Equal(t, v1alpha1.WorkflowFailed, status.Phase) }). ExpectWorkflowNode(func(status v1alpha1.NodeStatus) bool { return status.DisplayName == onExitNodeName }, func(t *testing.T, status *v1alpha1.NodeStatus, pod *apiv1.Pod) { - assert.Equal(t, true, status.NodeFlag.Hooked) + assert.True(t, status.NodeFlag.Hooked) assert.Equal(t, v1alpha1.NodeSucceeded, status.Phase) })) } @@ -862,12 +862,12 @@ spec: })). Then(). ExpectWorkflow(func(t *testing.T, metadata *v1.ObjectMeta, status *v1alpha1.WorkflowStatus) { - assert.Equal(t, status.Phase, v1alpha1.WorkflowFailed) + assert.Equal(t, v1alpha1.WorkflowFailed, status.Phase) }). ExpectWorkflowNode(func(status v1alpha1.NodeStatus) bool { return status.DisplayName == onExitNodeName }, func(t *testing.T, status *v1alpha1.NodeStatus, pod *apiv1.Pod) { - assert.Equal(t, true, status.NodeFlag.Hooked) + assert.True(t, status.NodeFlag.Hooked) assert.Equal(t, v1alpha1.NodeSucceeded, status.Phase) })) }