Skip to content

Commit

Permalink
Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ehl-jf committed Oct 22, 2024
1 parent 2b08cac commit 30c5246
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/commands/list_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
7 changes: 7 additions & 0 deletions test/infra/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package infra
import (
"encoding/json"
"os"
"sort"

"github.com/jfrog/jfrog-cli-platform-services/model"

Expand Down Expand Up @@ -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
})
}

0 comments on commit 30c5246

Please sign in to comment.