Skip to content

Commit

Permalink
Merge pull request redhat-appstudio#678 from jgwest/gitopsrvce-772-fi…
Browse files Browse the repository at this point in the history
…x-e2e-test-failure-sept-2023

GITOPSRVCE-772: fix intermittent E2E test failure in gitopsdeployment_test.go
  • Loading branch information
openshift-ci[bot] authored Oct 17, 2023
2 parents 136ee66 + 4dbdc0a commit 9fe4fc7
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests-e2e/fixture/appproject/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func HaveAppProjectSourceRepos(appProjectSpec appv1alpha1.AppProjectSpec) matche
return false
}

res := compareStringArrays(appProject.Spec.SourceRepos, appProjectSpec.SourceRepos)
res := compareStringArraysInAnyOrder(appProject.Spec.SourceRepos, appProjectSpec.SourceRepos)

fmt.Println("HaveAppProjectSourceRepos:", res, "/ Expected:", appProjectSpec, "/ Actual:", appProject.Spec.SourceRepos)
fmt.Println("HaveAppProjectSourceRepos:", res, "/ Expected:", appProjectSpec.SourceRepos, "/ Actual:", appProject.Spec.SourceRepos)

return res
}, BeTrue())
Expand Down Expand Up @@ -68,13 +68,24 @@ func HaveAppProjectDestinations(appProjectDestinations []appv1alpha1.Application
}, BeTrue())
}

func compareStringArrays(arr1, arr2 []string) bool {
func compareStringArraysInAnyOrder(arr1, arr2 []string) bool {
if len(arr1) != len(arr2) {
return false
}

for i := 0; i < len(arr1); i++ {
if arr1[i] != arr2[i] {

match := false

for j := 0; j < len(arr2); j++ {

if arr1[i] == arr2[j] {
match = true
break
}
}

if !match {
return false
}
}
Expand Down

0 comments on commit 9fe4fc7

Please sign in to comment.