Skip to content

Commit b79e3a1

Browse files
committed
wip of running e2e tests locally 6
1 parent 4f5473e commit b79e3a1

File tree

4 files changed

+35
-30
lines changed

4 files changed

+35
-30
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,10 @@ test-cover: test ## Run tests with code coverage and generate reports.
726726
.PHONY: create-bootstrap
727727
create-bootstrap: $(KUBECTL) ## Create capz kind bootstrap cluster.
728728
if [ "$(MGMT_CLUSTER_TYPE)" == "aks" ]; then \
729-
MGMT_CLUSTER_NAME=capz-e2e \
730-
AKS_RESOURCE_GROUP=capz-e2e \
731-
AKS_MGMT_VNET_NAME=capz-e2e-mgmt-vnet \
732-
AKS_MGMT_SUBNET_NAME=capz-e2e-mgmt-subnet \
729+
MGMT_CLUSTER_NAME=capz-e2e-4 \
730+
AKS_RESOURCE_GROUP=capz-e2e-4 \
731+
AKS_MGMT_VNET_NAME=capz-e2e-4-mgmt-vnet \
732+
AKS_MGMT_SUBNET_NAME=capz-e2e-4-mgmt-subnet \
733733
./scripts/aks-as-mgmt.sh; \
734734
else \
735735
KIND_CLUSTER_NAME=capz-e2e ./scripts/kind-with-registry.sh; \

templates/test/ci/prow-apiserver-ilb/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ patches:
2121
patch: |-
2222
- op: replace
2323
path: /spec/template/spec/preKubeadmCommands/0
24-
value: echo '${AZURE_INTERNAL_LB_PRIVATE_IP} ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com' >> /etc/hosts
24+
value: echo '${AZURE_INTERNAL_LB_PRIVATE_IP} ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com' >> /etc/hosts
2525
- target:
2626
kind: AzureCluster
2727
patch: |-

test/e2e/azure_apiserver_ilb.go

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ import (
8888
"bytes"
8989
"context"
9090
"fmt"
91-
"io"
9291
"os"
9392
"os/exec"
9493
"strings"
@@ -484,22 +483,35 @@ func PeerVnets(ctx context.Context, inputGetter func() AzureAPIServerILBSpecInpu
484483
Logf("cmd to be run %v", cmd)
485484

486485
// ------------------------ //
487-
// output, err := cmd.Output()
488-
// if err != nil {
489-
// Logf("Error running peer-vnets.sh: %v", err)
490-
// }
491-
// Logf("Output of peer-vnets.sh: %v", string(output))
486+
var stdoutBuf, stderrBuf bytes.Buffer
487+
488+
// Capture stdout, stderr separately
489+
cmd.Stdout = &stdoutBuf
490+
cmd.Stderr = &stderrBuf
491+
err := cmd.Run()
492+
493+
// Convert buffers to string
494+
stdoutStr := stdoutBuf.String()
495+
stderrStr := stderrBuf.String()
496+
497+
Logf("Stdout: %s", stdoutStr)
498+
Logf("Stderr: %s", stderrStr)
499+
500+
if err != nil {
501+
// Command failed (non-zero exit code or something else)
502+
Logf("Error: %v", err)
503+
}
492504

493505
/*
494506
// Replace the below block with the above block when debugging the peering VNets script
495507
// The below code suppresses the StdOut and StdErr
496508
*/
497509

498-
cmd.Stdout = io.Discard
499-
cmd.Stderr = io.Discard
500-
err := cmd.Run()
501-
if err != nil {
502-
Logf("Error running peer-vnets.sh: %v", err)
503-
}
510+
// cmd.Stdout = io.Discard
511+
// cmd.Stderr = io.Discard
512+
// err := cmd.Run()
513+
// if err != nil {
514+
// Logf("Error running peer-vnets.sh: %v", err)
515+
// }
504516
// ------------------------ //
505517
}

test/e2e/azure_test.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ var _ = Describe("Workload cluster creation", func() {
12651265
})
12661266
})
12671267

1268-
Context("Local test: Creating a self-managed VM based cluster using API Server ILB feature gate and fully spec-ed out APIServer ILB template [OPTIONAL][API-Server-ILB][LOCAL]", func() {
1268+
Context("Local test: Creating a self-managed VM based cluster using API Server ILB feature gate and fully spec-ed out APIServer ILB template [OPTIONAL][API-Server-ILB]", func() {
12691269
It("with three controlplane node and three worker nodes", func() {
12701270
clusterName = getClusterName(clusterNamePrefix, "apiserver-ilb")
12711271

@@ -1288,21 +1288,15 @@ var _ = Describe("Workload cluster creation", func() {
12881288
WaitForControlPlaneInitialized: EnsureControlPlaneInitializedNoAddons,
12891289
}),
12901290
withPostMachinesProvisioned(func() {
1291-
PeerVnets(ctx, func() AzureAPIServerILBSpecInput {
1292-
return AzureAPIServerILBSpecInput{
1293-
BootstrapClusterProxy: bootstrapClusterProxy,
1294-
Cluster: result.Cluster,
1295-
Namespace: namespace,
1296-
ClusterName: clusterName,
1297-
WaitIntervals: e2eConfig.GetIntervals(specName, "wait-worker-nodes"),
1298-
TemplateHasPrivateIPCustomDNSResolution: true,
1291+
EnsureDaemonsets(ctx, func() DaemonsetsSpecInput {
1292+
return DaemonsetsSpecInput{
1293+
BootstrapClusterProxy: bootstrapClusterProxy,
1294+
Namespace: namespace,
1295+
ClusterName: clusterName,
12991296
}
13001297
})
13011298
}),
13021299
// withPreWaitForCluster(func() {
1303-
// // TODO: only invoke this in local runs
1304-
// // Peer VNets of the mgmt cluster and workload cluster
1305-
//
13061300
// }),
13071301
), result)
13081302

@@ -1323,6 +1317,5 @@ var _ = Describe("Workload cluster creation", func() {
13231317
By("PASSED!")
13241318
})
13251319
})
1326-
13271320
// TODO: add a same test as above for a windows cluster
13281321
})

0 commit comments

Comments
 (0)