-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Implement e2e integration testing by using CAPI v1.6 test framework #147
Merged
k8s-ci-robot
merged 1 commit into
kubernetes-sigs:main
from
Jont828:capi-test-framework
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,8 @@ GINKGO_NODES ?= 1 | |
GINKGO_TIMEOUT ?= 2h | ||
GINKGO_POLL_PROGRESS_AFTER ?= 60m | ||
GINKGO_POLL_PROGRESS_INTERVAL ?= 5m | ||
# E2E_CONF_FILE ?= $(ROOT_DIR)/$(TEST_DIR)/e2e/config/docker.yaml | ||
E2E_CONF_FILE ?= $(ROOT_DIR)/$(TEST_DIR)/e2e/config/helm.yaml | ||
E2E_CONF_FILE_ENVSUBST := $(ROOT_DIR)/test/e2e/config/helm-envsubst.yaml | ||
SKIP_RESOURCE_CLEANUP ?= false | ||
USE_EXISTING_CLUSTER ?= false | ||
GINKGO_NOCOLOR ?= false | ||
|
@@ -263,6 +264,16 @@ generate-modules: ## Run go mod tidy to ensure modules are up to date | |
go mod tidy | ||
cd $(TOOLS_DIR); go mod tidy | ||
|
||
DOCKER_TEMPLATES := test/e2e/data/addons-helm | ||
|
||
.PHONY: generate-e2e-templates | ||
generate-e2e-templates: $(KUSTOMIZE) ## Generate templates for e2e tests | ||
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta1/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta1/cluster-template.yaml | ||
|
||
.PHONY: generate-flavors | ||
generate-flavors: $(KUSTOMIZE) ## Generate template flavors. | ||
./hack/gen-flavors.sh | ||
|
||
## -------------------------------------- | ||
## Lint / Verify | ||
## -------------------------------------- | ||
|
@@ -383,15 +394,34 @@ test-cover: ## Run unit and integration tests and generate a coverage report | |
go tool cover -func=out/coverage.out -o out/coverage.txt | ||
go tool cover -html=out/coverage.out -o out/coverage.html | ||
|
||
# .PHONY: test-e2e | ||
# test-e2e: $(GINKGO) generate-e2e-templates generate-test-extension-deployment ## Run the end-to-end tests | ||
# $(GINKGO) -v --trace -poll-progress-after=$(GINKGO_POLL_PROGRESS_AFTER) \ | ||
# -poll-progress-interval=$(GINKGO_POLL_PROGRESS_INTERVAL) --tags=e2e --focus="$(GINKGO_FOCUS)" \ | ||
# $(_SKIP_ARGS) --nodes=$(GINKGO_NODES) --timeout=$(GINKGO_TIMEOUT) --no-color=$(GINKGO_NOCOLOR) \ | ||
# --output-dir="$(ARTIFACTS)" --junit-report="junit.e2e_suite.1.xml" $(GINKGO_ARGS) $(ROOT_DIR)/$(TEST_DIR)/e2e -- \ | ||
# -e2e.artifacts-folder="$(ARTIFACTS)" \ | ||
# -e2e.config="$(E2E_CONF_FILE)" \ | ||
# -e2e.skip-resource-cleanup=$(SKIP_RESOURCE_CLEANUP) -e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER) | ||
|
||
.PHONY: test-e2e | ||
test-e2e: ## Run "docker-build" and "docker-push" rules then run e2e tests. | ||
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \ | ||
$(MAKE) docker-build docker-push \ | ||
test-e2e-run | ||
|
||
.PHONY: test-e2e-run-skip-manifest | ||
test-e2e-run-skip-manifest: $(GINKGO) $(ENVSUBST) generate-e2e-templates ## Run the end-to-end tests | ||
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \ | ||
$(GINKGO) -v --trace -poll-progress-after=$(GINKGO_POLL_PROGRESS_AFTER) \ | ||
-poll-progress-interval=$(GINKGO_POLL_PROGRESS_INTERVAL) --tags=e2e --focus="$(GINKGO_FOCUS)" \ | ||
$(_SKIP_ARGS) --nodes=$(GINKGO_NODES) --timeout=$(GINKGO_TIMEOUT) --no-color=$(GINKGO_NOCOLOR) \ | ||
--output-dir="$(ARTIFACTS)" --junit-report="junit.e2e_suite.1.xml" $(GINKGO_ARGS) $(ROOT_DIR)/$(TEST_DIR)/e2e -- \ | ||
-e2e.artifacts-folder="$(ARTIFACTS)" \ | ||
-e2e.config="$(E2E_CONF_FILE_ENVSUBST)" \ | ||
-e2e.skip-resource-cleanup=$(SKIP_RESOURCE_CLEANUP) -e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER) | ||
|
||
.PHONY: test-e2e-run | ||
test-e2e-run: | ||
$(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/default/manager_image_patch.yaml" | ||
$(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/default/manager_pull_policy.yaml" PULL_POLICY=IfNotPresent | ||
MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \ | ||
$(MAKE) test-e2e-run-skip-manifest | ||
|
||
.PHONY: get-e2e-kubeconfig | ||
get-e2e-kubeconfig: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a |
||
@kind get kubeconfig --name caaph-e2e | ||
|
||
## -------------------------------------- | ||
## Deployment | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2024 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
# shellcheck disable=SC2034 | ||
KUBECTL="${REPO_ROOT}/hack/tools/bin/kubectl" | ||
# shellcheck disable=SC2034 | ||
KUSTOMIZE="${REPO_ROOT}/hack/tools/bin/kustomize" | ||
# shellcheck disable=SC2034 | ||
ENVSUBST="${REPO_ROOT}/hack/tools/bin/envsubst" | ||
# shellcheck disable=SC2034 | ||
YQ="${REPO_ROOT}/hack/tools/bin/yq" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a
make help
comment here? And maybe clarify the one above fortest-e2e-run-skip-manifest
?