Skip to content

Commit 9f8d796

Browse files
committed
make frontproxy tests work
On-behalf-of: SAP <[email protected]> Signed-off-by: Simon Bein <[email protected]>
1 parent e50e958 commit 9f8d796

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

test/e2e/frontproxies/frontproxies_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131
"k8s.io/apimachinery/pkg/types"
3232
ctrlruntime "sigs.k8s.io/controller-runtime"
33-
ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client"
3433

3534
operatorv1alpha1 "github.com/kcp-dev/kcp-operator/sdk/apis/operator/v1alpha1"
3635
"github.com/kcp-dev/kcp-operator/test/utils"
@@ -72,6 +71,7 @@ func TestCreateFrontProxy(t *testing.T) {
7271
},
7372
Groups: []string{"system:masters"},
7473
}
74+
7575
t.Log("Creating kubeconfig for FrontProxy…")
7676
if err := client.Create(ctx, &fpConfig); err != nil {
7777
t.Fatal(err)

test/utils/deploy.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ func DeployFrontProxy(ctx context.Context, t *testing.T, client ctrlruntimeclien
169169
Name: rootShardName,
170170
},
171171
},
172+
ExternalHostname: fmt.Sprintf("%s.%s.svc.cluster.local", frontProxy.Name, frontProxy.Namespace),
173+
Auth: &operatorv1alpha1.AuthSpec{
174+
// we need to remove the default system:masters group in order to do our testing
175+
DropGroups: []string{""},
176+
},
172177
}
173178

174179
for _, patch := range patches {

test/utils/utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ func ConnectWithKubeconfig(
182182
parts := strings.Split(hostname, ".")
183183
serviceName := parts[0]
184184

185+
// for frontproxies add required suffix
186+
if config.Spec.Target.FrontProxyRef != nil {
187+
serviceName += "-front-proxy"
188+
}
189+
185190
portNum, err := strconv.ParseInt(portString, 10, 32)
186191
if err != nil {
187192
t.Fatalf("Failed to parse kubeconfig's port %q: %v", portString, err)

0 commit comments

Comments
 (0)