Skip to content

Commit 5a15bc7

Browse files
authored
use namespace kong for integration tests (#4439)
* use namespace kong for integration tests * use namespace kong in conformance tests
1 parent f43037f commit 5a15bc7

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

test/conformance/suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"k8s.io/client-go/kubernetes"
2424

2525
testutils "github.com/kong/kubernetes-ingress-controller/v2/internal/util/test"
26+
"github.com/kong/kubernetes-ingress-controller/v2/test/consts"
2627
"github.com/kong/kubernetes-ingress-controller/v2/test/internal/testenv"
2728
)
2829

@@ -63,7 +64,8 @@ func TestMain(m *testing.M) {
6364
globalLogger = logger
6465

6566
// In order to pass conformance tests, the expression router is required.
66-
kongBuilder := kong.NewBuilder().WithControllerDisabled().WithProxyAdminServiceTypeLoadBalancer()
67+
kongBuilder := kong.NewBuilder().WithControllerDisabled().WithProxyAdminServiceTypeLoadBalancer().
68+
WithNamespace(consts.ControllerNamespace)
6769
if expressionRoutesEnabled() {
6870
kongBuilder = kongBuilder.WithProxyEnvVar("router_flavor", "expressions")
6971
}

test/consts/misc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ const (
1414
IngressClass = "kongtests"
1515

1616
// ControllerNamespace is the Kubernetes namespace where the controller is deployed.
17-
ControllerNamespace = "kong-system"
17+
ControllerNamespace = "kong"
1818
)

test/helpers/certificate/certificate.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"fmt"
1111
"math/big"
1212
"time"
13+
14+
"github.com/kong/kubernetes-ingress-controller/v2/test/consts"
1315
)
1416

1517
type SelfSignedCeritificateOptions struct {
@@ -104,11 +106,12 @@ func MustGenerateSelfSignedCertPEMFormat(decorators ...SelfSignedCeritificateOpt
104106
}
105107

106108
var kongSystemServiceCert, kongSystemServiceKey = MustGenerateSelfSignedCertPEMFormat(
107-
WithCommonName("*.kong-system.svc"), WithDNSNames("*.kong-system.svc"),
109+
WithCommonName(fmt.Sprintf("*.%s.svc", consts.ControllerNamespace)),
110+
WithDNSNames(fmt.Sprintf("*.%s.svc", consts.ControllerNamespace)),
108111
)
109112

110113
// GetKongSystemSelfSignedCerts returns the self-signed certificate and key
111-
// with CN=*.kong-system.svc and subjectAltName=DNS:*.kong-system.svc.
114+
// with CN=*.<controllerNamespace>.svc and subjectAltName=DNS:*.<controllerNamespace>.svc.
112115
func GetKongSystemSelfSignedCerts() (cert []byte, key []byte) {
113116
return kongSystemServiceCert, kongSystemServiceKey
114117
}

test/integration/gateway_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ package integration
44

55
import (
66
"context"
7+
"fmt"
78
"net/http"
9+
"strings"
810
"testing"
911
"time"
1012

@@ -64,7 +66,13 @@ func TestUnmanagedGatewayBasics(t *testing.T) {
6466
require.Eventually(t, func() bool {
6567
gw, err = gatewayClient.GatewayV1beta1().Gateways(ns.Name).Get(ctx, defaultGatewayName, metav1.GetOptions{})
6668
require.NoError(t, err)
67-
return gw.Annotations[annotations.GatewayClassUnmanagedAnnotation] == "kong-system/ingress-controller-kong-proxy,kong-system/ingress-controller-kong-udp-proxy"
69+
return gw.Annotations[annotations.GatewayClassUnmanagedAnnotation] == strings.Join(
70+
[]string{
71+
fmt.Sprintf("%s/%s", pubsvc.Namespace, pubsvc.Name),
72+
fmt.Sprintf("%s/%s", pubsvcUDP.Namespace, pubsvcUDP.Name),
73+
},
74+
",",
75+
)
6876
}, gatewayUpdateWaitTime, time.Second)
6977

7078
t.Log("verifying that the gateway address is populated from the publish service")

test/internal/helpers/ktf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// GenerateKongBuilder returns a Kong KTF addon builder, a string slice
1414
// of controller arguments needed to interact with the addon and an error.
1515
func GenerateKongBuilder(_ context.Context) (*kong.Builder, []string, error) {
16-
kongbuilder := kong.NewBuilder()
16+
kongbuilder := kong.NewBuilder().WithNamespace(consts.ControllerNamespace)
1717
extraControllerArgs := []string{}
1818
if testenv.KongEnterpriseEnabled() {
1919
licenseJSON, err := kong.GetLicenseJSONFromEnv()

0 commit comments

Comments
 (0)