Skip to content

Commit 03364a3

Browse files
committed
wip of running e2e tests locally 3
1 parent 3ad3cc2 commit 03364a3

File tree

4 files changed

+36
-9
lines changed

4 files changed

+36
-9
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,8 @@ test-cover: test ## Run tests with code coverage and generate reports.
723723
./hack/codecov-ignore.sh
724724
go tool cover -html=coverage.out -o coverage.html
725725

726-
.PHONY: kind-create-bootstrap
727-
kind-create-bootstrap: $(KUBECTL) ## Create capz kind bootstrap cluster.
726+
.PHONY: create-bootstrap
727+
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 \

e2e.mk

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
##@ E2E Testing:
77
.PHONY: test-e2e-run
8-
test-e2e-run: generate-e2e-templates install-tools kind-create-bootstrap ## Run e2e tests.
9-
@source ./scripts/peer-vnets.sh && source_tilt_settings tilt-settings.yaml; \
8+
test-e2e-run: generate-e2e-templates install-tools create-bootstrap ## Run e2e tests.
9+
if [ "$(MGMT_CLUSTER_TYPE)" == "aks" ]; then \
10+
source ./scripts/peer-vnets.sh && source_tilt_settings tilt-settings.yaml; \
11+
fi; \
1012
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
1113
if [ -z "${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}" ]; then \
1214
export AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY=$(shell cat $(AZURE_IDENTITY_ID_FILEPATH)); \
@@ -19,21 +21,32 @@ test-e2e-run: generate-e2e-templates install-tools kind-create-bootstrap ## Run
1921
$(MAKE) cleanup-workload-identity
2022
$(MAKE) clean-release-git
2123

24+
2225
.PHONY: test-e2e
2326
test-e2e: ## Run "docker-build" and "docker-push" rules then run e2e tests.
24-
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
27+
# $$ARCH is set to amd64 for aks cluster type
28+
if [ "$(MGMT_CLUSTER_TYPE)" = "aks" ]; then \
29+
export ARCH=amd64; \
30+
fi; \
31+
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$$ARCH:$(TAG) \
2532
$(MAKE) docker-build docker-push \
2633
test-e2e-run
2734

2835
.PHONY: test-e2e-skip-push
2936
test-e2e-skip-push: ## Run "docker-build" rule then run e2e tests.
30-
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
37+
if [ "$(MGMT_CLUSTER_TYPE)" = "aks" ]; then \
38+
export ARCH=amd64; \
39+
fi; \
40+
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$$ARCH:$(TAG) \
3141
$(MAKE) docker-build \
3242
test-e2e-run
3343

3444
.PHONY: test-e2e-skip-build-and-push
3545
test-e2e-skip-build-and-push:
36-
$(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/capz/manager_image_patch.yaml"
37-
$(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/capz/manager_pull_policy.yaml" PULL_POLICY=IfNotPresent
38-
MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
46+
if [ "$(MGMT_CLUSTER_TYPE)" = "aks" ]; then \
47+
export ARCH=amd64; \
48+
fi; \
49+
$(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$$ARCH MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/capz/manager_image_patch.yaml" \
50+
$(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/capz/manager_pull_policy.yaml" PULL_POLICY=IfNotPresent \
51+
MANAGER_IMAGE=$(CONTROLLER_IMG)-$$ARCH:$(TAG) \
3952
$(MAKE) test-e2e-run

scripts/ci-e2e.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,14 @@ trap capz::ci-e2e::cleanup EXIT
7979
# Image is configured as `${CONTROLLER_IMG}-${ARCH}:${TAG}` where `CONTROLLER_IMG` is defaulted to `${REGISTRY}/${IMAGE_NAME}`.
8080
if [[ "${BUILD_MANAGER_IMAGE}" == "false" ]]; then
8181
# Load an existing image, skip docker-build and docker-push.
82+
echo "running make test-e2e-skip-build-and-push"
8283
make test-e2e-skip-build-and-push
8384
elif [[ "${USE_LOCAL_KIND_REGISTRY}" == "true" ]]; then
8485
# Build an image with kind local registry, skip docker-push. REGISTRY is set to `localhost:5000/ci-e2e`. TAG is set to `$(date -u '+%Y%m%d%H%M%S')`.
86+
echo "running make test-e2e-skip-push"
8587
make test-e2e-skip-push
8688
else
8789
# Build an image and push to the registry. TAG is set to `$(date -u '+%Y%m%d%H%M%S')`.
90+
echo "running make test-e2e"
8891
make test-e2e
8992
fi

test/e2e/azure_apiserver_ilb.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,4 +466,15 @@ func AzureAPIServerILBSpec(ctx context.Context, inputGetter func() AzureAPIServe
466466
func PeerVnets(ctx context.Context, inputGetter func() AzureAPIServerILBSpecInput) {
467467
// TODO: shall I have this shell commands in this func instead ?
468468
Logf("In PeerVnets func")
469+
470+
// shell commands
471+
cmd := exec.Command("bash", "-c", "source ./scripts/peer-vnets.sh && peer_vnets")
472+
473+
output, err := cmd.CombinedOutput()
474+
if err != nil {
475+
return fmt.Errorf("failed to invoke shell function: %w\nOutput: %s", err, string(output))
476+
}
477+
478+
fmt.Println(string(output))
479+
469480
}

0 commit comments

Comments
 (0)