diff --git a/test/commands/list_cmd_test.go b/test/commands/list_cmd_test.go index 3f504ba..080f81f 100644 --- a/test/commands/list_cmd_test.go +++ b/test/commands/list_cmd_test.go @@ -168,6 +168,9 @@ func assertWorkerListJSON(workers ...*model.WorkerDetails) func(t require.Testin assert.Equalf(t, len(workers), len(gotWorkers.Workers), "Length mismatch") + infra.SortWorkers(workers) + infra.SortWorkers(gotWorkers.Workers) + for i, wantWorker := range workers { gotWorker := gotWorkers.Workers[i] diff --git a/test/infra/test_utils.go b/test/infra/test_utils.go index a8d0e6b..2685223 100644 --- a/test/infra/test_utils.go +++ b/test/infra/test_utils.go @@ -5,6 +5,7 @@ package infra import ( "encoding/json" "os" + "sort" "github.com/jfrog/jfrog-cli-platform-services/model" @@ -51,3 +52,9 @@ func PatchWorker(s *model.WorkerDetails, applyPatch func(w *model.WorkerDetails) applyPatch(&t) return &t } + +func SortWorkers(workers []*model.WorkerDetails) { + sort.Slice(workers, func(i, j int) bool { + return workers[i].Key < workers[j].Key + }) +}