Skip to content

Commit c578d0d

Browse files
Merge pull request #3673 from pasanw/fix-dex-pol-flake
Fix Dex policy test flake
2 parents 8ee8d1e + 5ab7736 commit c578d0d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/render/dex_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package render_test
1616

1717
import (
18-
"encoding/json"
1918
"fmt"
2019

2120
. "github.com/onsi/ginkgo"
@@ -527,9 +526,14 @@ var _ = Describe("dex rendering tests", func() {
527526

528527
policy := testutils.GetAllowTigeraPolicyFromResources(policyName, resources)
529528
expectedPolicy := getExpectedPolicy(scenario)
530-
policyJ, _ := json.Marshal(policy)
531-
expectedPolicyJ, _ := json.Marshal(expectedPolicy)
532-
Expect(string(policyJ)).To(Equal(string(expectedPolicyJ)))
529+
Expect(policy.Spec.Selector).To(Equal(policy.Spec.Selector))
530+
Expect(policy.Spec.Tier).To(Equal(policy.Spec.Tier))
531+
Expect(policy.Spec.Order).To(Equal(policy.Spec.Order))
532+
Expect(policy.Spec.Types).To(Equal(policy.Spec.Types))
533+
534+
// The order of insertion of rules is not guaranteed by the render implementation.
535+
Expect(policy.Spec.Ingress).To(ContainElements(expectedPolicy.Spec.Ingress))
536+
Expect(policy.Spec.Egress).To(ContainElements(expectedPolicy.Spec.Egress))
533537
},
534538
// Dex only renders in the presence of an Authentication CR, therefore does not have a config option for managed clusters.
535539
Entry("for management/standalone, kube-dns", testutils.AllowTigeraScenario{ManagedCluster: false, OpenShift: false}),

0 commit comments

Comments
 (0)