Skip to content

Commit 736d865

Browse files
committed
fix tests for stack ingress and rg generation
1 parent 6b8807c commit 736d865

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

cmd/stackset-controller/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
defaultMetricsAddress = ":7979"
2929
defaultClientGOTimeout = 30 * time.Second
3030
defaultReconcileWorkers = "10"
31-
defaultPerStackDomain = ".ingress.cluster.local"
31+
defaultPerStackDomain = "ingress.cluster.local"
3232
)
3333

3434
var (

pkg/core/stack_resources_test.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package core
22

33
import (
44
"errors"
5+
"fmt"
56
"reflect"
67
"slices"
78
"strconv"
@@ -54,6 +55,10 @@ var (
5455
}
5556
)
5657

58+
const (
59+
perStackDomain = "ingress.cluster.local"
60+
)
61+
5762
func TestGetServicePorts(tt *testing.T) {
5863
backendPort := intstr.FromInt(int(8080))
5964
backendPort2 := intstr.FromInt(int(8081))
@@ -307,7 +312,9 @@ func TestStackGenerateIngress(t *testing.T) {
307312
stackGenerationAnnotationKey: "11",
308313
"ingress": "annotation",
309314
},
310-
expectedHosts: []string{"foo-v1.example.org"},
315+
expectedHosts: []string{
316+
fmt.Sprintf("foo-v1.%s", perStackDomain),
317+
},
311318
},
312319
} {
313320
t.Run(tc.name, func(t *testing.T) {
@@ -320,7 +327,8 @@ func TestStackGenerateIngress(t *testing.T) {
320327
stacksetName: "foo",
321328
ingressSpec: tc.ingressSpec,
322329
backendPort: &intStrBackendPort,
323-
perStackDomain: "example.org",
330+
clusterDomains: []string{"example.org"},
331+
perStackDomain: perStackDomain,
324332
}
325333
ingress, err := c.GenerateIngress()
326334

@@ -618,7 +626,9 @@ func TestStackGenerateRouteGroup(t *testing.T) {
618626
stackGenerationAnnotationKey: "11",
619627
"routegroup": "annotation",
620628
},
621-
expectedHosts: []string{"foo-v1.example.org"},
629+
expectedHosts: []string{
630+
fmt.Sprintf("foo-v1.%s", perStackDomain),
631+
},
622632
},
623633
{
624634
name: "custom load balancer",
@@ -635,7 +645,9 @@ func TestStackGenerateRouteGroup(t *testing.T) {
635645
expectedAnnotations: map[string]string{
636646
stackGenerationAnnotationKey: "11",
637647
},
638-
expectedHosts: []string{"foo-v1.example.org"},
648+
expectedHosts: []string{
649+
fmt.Sprintf("foo-v1.%s", perStackDomain),
650+
},
639651
},
640652
} {
641653
t.Run(tc.name, func(t *testing.T) {
@@ -648,7 +660,8 @@ func TestStackGenerateRouteGroup(t *testing.T) {
648660
stacksetName: "foo",
649661
routeGroupSpec: tc.routeGroupSpec,
650662
backendPort: &intStrBackendPort,
651-
perStackDomain: "example.org",
663+
clusterDomains: []string{"example.org"},
664+
perStackDomain: perStackDomain,
652665
}
653666
rg, err := c.GenerateRouteGroup()
654667
if tc.expectError {

0 commit comments

Comments
 (0)