Skip to content

Commit

Permalink
update old edge tests to no longer expect edges by default
Browse files Browse the repository at this point in the history
Signed-off-by: Alice-Lilith <[email protected]>
  • Loading branch information
Alice-Lilith committed Feb 21, 2025
1 parent ae62dab commit dc007bf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 5 additions & 1 deletion internal/store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,12 @@ var _ = Describe("Store", func() {
})

Context("when ingress has unsupported default backend", func() {
It("ignores the ingress with default backend and returns an error", func() {
It("ignores the ingress with default backend and returns an error with mapping-strategy: edges", func() {
ing := testutils.NewTestIngressV1("ingress-default-backend", "test-namespace")
if ing.Annotations == nil {
ing.Annotations = map[string]string{}
}
ing.Annotations["k8s.ngrok.com/mapping-strategy"] = "edges"
ing.Spec.DefaultBackend = &netv1.IngressBackend{
Service: &netv1.IngressServiceBackend{
Name: "default-service",
Expand Down
21 changes: 19 additions & 2 deletions pkg/managerdriver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,19 @@ var _ = Describe("Driver", func() {
Expect(tunnels.Items).To(HaveLen(0))
})
})
Context("When there are just ingresses and CRDs need to be created", func() {
Context("When there are just edge ingresses and edges need to be created", func() {
It("Should create the CRDs", func() {
i1 := testutils.NewTestIngressV1("test-ingress", "test-namespace")
if i1.Annotations == nil {
i1.Annotations = map[string]string{}
}
i1.Annotations["k8s.ngrok.com/mapping-strategy"] = "edges"
i2 := testutils.NewTestIngressV1("test-ingress-2", "test-namespace")
if i2.Annotations == nil {
i2.Annotations = map[string]string{}
}
i2.Annotations["k8s.ngrok.com/mapping-strategy"] = "edges"

ic1 := testutils.NewTestIngressClass("test-ingress-class", true, true)
ic2 := testutils.NewTestIngressClass("test-ingress-class-2", true, true)
s := testutils.NewTestServiceV1("example", "test-namespace")
Expand Down Expand Up @@ -664,11 +673,15 @@ var _ = Describe("Driver", func() {
})
})

Describe("When no ingresses are opted in to use endpoints", func() {
Describe("When ingresses are opted in to use edges", func() {
It("Should create edges and not endpoints", func() {
ic1 := testutils.NewTestIngressClass("test-ingress-class", true, true)

i1 := testutils.NewTestIngressV1WithClass("ingress-1", "test-namespace", ic1.Name)
if i1.Annotations == nil {
i1.Annotations = map[string]string{}
}
i1.Annotations["k8s.ngrok.com/mapping-strategy"] = "edges"
i1.Spec.Rules = []netv1.IngressRule{
{
Host: "a.customdomain.com",
Expand Down Expand Up @@ -723,6 +736,10 @@ var _ = Describe("Driver", func() {
},
}
i2 := testutils.NewTestIngressV1WithClass("ingress-2", "other-namespace", ic1.Name)
if i2.Annotations == nil {
i2.Annotations = map[string]string{}
}
i2.Annotations["k8s.ngrok.com/mapping-strategy"] = "edges"
i2.Spec.Rules = []netv1.IngressRule{
{
Host: "c.customdomain.com",
Expand Down

0 comments on commit dc007bf

Please sign in to comment.