Skip to content

Commit 21ed65f

Browse files
committed
wip of running e2e tests locally 2
1 parent 32fd758 commit 21ed65f

File tree

6 files changed

+42
-16
lines changed

6 files changed

+42
-16
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ kind-create-bootstrap: $(KUBECTL) ## Create capz kind bootstrap cluster.
728728
if [ "$(MGMT_CLUSTER_TYPE)" == "aks" ]; then \
729729
MGMT_CLUSTER_NAME=capz-e2e \
730730
AKS_RESOURCE_GROUP=capz-e2e \
731+
AKS_MGMT_VNET_NAME=capz-e2e-mgmt-vnet \
732+
AKS_MGMT_SUBNET_NAME=capz-e2e-mgmt-subnet \
731733
./scripts/aks-as-mgmt.sh; \
732734
else \
733735
KIND_CLUSTER_NAME=capz-e2e ./scripts/kind-with-registry.sh; \

e2e.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
##@ E2E Testing:
77
.PHONY: test-e2e-run
88
test-e2e-run: generate-e2e-templates install-tools kind-create-bootstrap ## Run e2e tests.
9-
@$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
9+
@source ./scripts/peer-vnets.sh && source_tilt_settings tilt-settings.yaml; \
10+
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
1011
if [ -z "${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}" ]; then \
1112
export AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY=$(shell cat $(AZURE_IDENTITY_ID_FILEPATH)); \
1213
fi; \

scripts/peer-vnets.sh

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,22 @@ set -o pipefail # make the pipeline fail if any command in it fails.
2020
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2121

2222
source_tilt_settings() {
23-
if [ "$#" -ne 1 ]; then
24-
echo "Usage: $0 <tilt-settings.yaml>"
25-
exit 1
23+
24+
found=false
25+
# echo "checking for tilt-settings.yaml..."
26+
# echo "args: $@"
27+
for arg in "$@"; do
28+
if [ "$arg" == "tilt-settings.yaml" ]; then
29+
found=true
30+
break
31+
fi
32+
done
33+
34+
if [ "$found" == true ]; then
35+
echo "tilt-settings.yaml was passed as an argument."
36+
else
37+
echo "tilt-settings.yaml was not found."
38+
exit 1
2639
fi
2740

2841
TILT_SETTINGS_FILE="$1"
@@ -33,18 +46,18 @@ source_tilt_settings() {
3346
exit 1
3447
fi
3548

36-
echo "Reading variables from $TILT_SETTINGS_FILE under 'kustomize_substition'..."
49+
echo "Reading variables from $TILT_SETTINGS_FILE under 'kustomize_substitutions'..."
3750

38-
# Get the list of keys under kustomize_substition
39-
VAR_KEYS=$(yq e '.kustomize_substition | keys | .[]' "$TILT_SETTINGS_FILE" 2>/dev/null || true)
51+
# Get the list of keys under kustomize_substitutions
52+
VAR_KEYS=$(yq e '.kustomize_substitutions | keys | .[]' "$TILT_SETTINGS_FILE" 2>/dev/null || true)
4053

4154
# If there's no such key or it's empty, VAR_KEYS will be empty
4255
if [ -z "$VAR_KEYS" ]; then
43-
echo "No variables found under 'kustomize_substition'."
56+
echo "No variables found under 'kustomize_substitutions'."
4457
else
4558
for key in $VAR_KEYS; do
4659
# Read the value of each key
47-
value=$(yq e ".kustomize_substition[\"$key\"]" "$TILT_SETTINGS_FILE")
60+
value=$(yq e ".kustomize_substitutions[\"$key\"]" "$TILT_SETTINGS_FILE")
4861
# Export the key/value pair
4962
export "$key=$value"
5063
echo "Exported $key=$value"

test/e2e/azure_apiserver_ilb.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,5 +464,6 @@ func AzureAPIServerILBSpec(ctx context.Context, inputGetter func() AzureAPIServe
464464
}
465465

466466
func PeerVnets(ctx context.Context, inputGetter func() AzureAPIServerILBSpecInput) {
467-
467+
// TODO: shall I have this shell commands in this func instead ?
468+
Logf("In PeerVnets func")
468469
}

test/e2e/azure_test.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,11 +1180,6 @@ var _ = Describe("Workload cluster creation", func() {
11801180
}
11811181
})
11821182
}),
1183-
withPreWaitForCluster(func() {
1184-
// TODO: only invoke this in local runs
1185-
// Peer VNets of the mgmt cluster and workload cluster
1186-
1187-
}),
11881183
), result)
11891184

11901185
By("Probing workload cluster with APIServerILB feature gate", func() {
@@ -1236,6 +1231,20 @@ var _ = Describe("Workload cluster creation", func() {
12361231
}
12371232
})
12381233
}),
1234+
withPreWaitForCluster(func() {
1235+
// TODO: only invoke this in local runs
1236+
// Peer VNets of the mgmt cluster and workload cluster
1237+
PeerVnets(ctx, func() AzureAPIServerILBSpecInput {
1238+
return AzureAPIServerILBSpecInput{
1239+
BootstrapClusterProxy: bootstrapClusterProxy,
1240+
Cluster: result.Cluster,
1241+
Namespace: namespace,
1242+
ClusterName: clusterName,
1243+
WaitIntervals: e2eConfig.GetIntervals(specName, "wait-worker-nodes"),
1244+
TemplateHasPrivateIPCustomDNSResolution: true,
1245+
}
1246+
})
1247+
}),
12391248
), result)
12401249

12411250
By("Probing workload cluster with APIServerILB feature gate", func() {

test/e2e/config/azure-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ variables:
228228
IP_FAMILY: "IPv4"
229229
CLUSTER_IDENTITY_NAME: "${CLUSTER_IDENTITY_NAME:-cluster-identity-ci}"
230230
ASO_CREDENTIAL_SECRET_NAME: "${ASO_CREDENTIAL_SECRET_NAME:-aso-credentials}"
231-
ASO_CREDENTIAL_SECRET_MODE: "${ASO_CREDENTIAL_SECRET_MODE:-workloadidentity}
231+
ASO_CREDENTIAL_SECRET_MODE: "${ASO_CREDENTIAL_SECRET_MODE:-workloadidentity}"
232232
NODE_DRAIN_TIMEOUT: "60s"
233233
CI_VERSION: ""
234234
KUBETEST_CONFIGURATION: "./data/kubetest/conformance.yaml"

0 commit comments

Comments
 (0)