Skip to content

Commit 0506de5

Browse files
piyush-gargchmouel
authored andcommitted
Fix flaky unit tests
This fixes the flaky unit tests, as they were failing because of the order of the elements of array
1 parent b63b9be commit 0506de5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/kubeinteraction/status/task_status_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import (
99
testclient "github.com/openshift-pipelines/pipelines-as-code/pkg/test/clients"
1010
"github.com/openshift-pipelines/pipelines-as-code/pkg/test/kubernetestint"
1111
tektontest "github.com/openshift-pipelines/pipelines-as-code/pkg/test/tekton"
12+
"github.com/stretchr/testify/assert"
1213
tektonv1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
1314
"go.uber.org/zap"
1415
zapobserver "go.uber.org/zap/zaptest/observer"
15-
"gotest.tools/v3/assert"
16+
assertv3 "gotest.tools/v3/assert"
1617
corev1 "k8s.io/api/core/v1"
1718
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1819
"k8s.io/apimachinery/pkg/runtime"
@@ -293,11 +294,11 @@ func TestGetStatusFromTaskStatusOrFromAsking(t *testing.T) {
293294
for _, prtrs := range statuses {
294295
displayNames = append(displayNames, prtrs.Status.TaskSpec.DisplayName)
295296
}
296-
assert.DeepEqual(t, tt.displayNames, displayNames)
297+
assert.ElementsMatch(t, tt.displayNames, displayNames)
297298
}
298299
if tt.expectedLogSnippet != "" {
299300
logmsg := obslog.FilterMessageSnippet(tt.expectedLogSnippet).TakeAll()
300-
assert.Assert(t, len(logmsg) > 0, "log messages", logmsg, tt.expectedLogSnippet)
301+
assertv3.Assert(t, len(logmsg) > 0, "log messages", logmsg, tt.expectedLogSnippet)
301302
}
302303
})
303304
}

0 commit comments

Comments
 (0)