-
Notifications
You must be signed in to change notification settings - Fork 318
tests(e2e): create e2e testing module based on ginkgo #1375
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
Open
dkarpele
wants to merge
13
commits into
argoproj-labs:master
Choose a base branch
from
dkarpele:dk-GITOPS-7468
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7db953f
tests(e2e): create e2e testing module based on ginkgo
dkarpele c5da3ff
review fixes
dkarpele 35d59dd
coderabbit review fixes
dkarpele cbd78f7
coderabbit review fixes #2
dkarpele 54e1533
rollback NewInteractiveDeferredLoadingClientConfig change
dkarpele 591a225
timeout after operator deployment
dkarpele c9651ac
try 1 run in 1 proc instead of 5
dkarpele 4830ef7
add debugging
dkarpele 503a87b
back to latest
dkarpele c2b0594
try with timeout
dkarpele 733dde0
apply argocd operator fix
dkarpele 0ad1162
apply argocd operator fix 2
dkarpele d94b0ac
apply argocd operator fix 3
dkarpele 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,112 @@ | ||
| # Default image for argocd-operator. Can be overridden. | ||
| ARGOCD_OPERATOR_IMAGE ?= quay.io/argoprojlabs/argocd-operator:latest | ||
|
|
||
| # Get version from root VERSION file | ||
| IMAGE_NAMESPACE?=quay.io/argoprojlabs | ||
| IMAGE_NAME=argocd-image-updater | ||
| ifdef IMAGE_NAMESPACE | ||
| IMAGE_PREFIX=${IMAGE_NAMESPACE}/ | ||
| else | ||
| IMAGE_PREFIX= | ||
| endif | ||
|
|
||
| VERSION := $(shell cat ../../VERSION) | ||
| IMAGE_TAG?=v${VERSION} | ||
| # Image URL to use all building/pushing image targets | ||
| ARGOCD_IMAGE_UPDATER_IMAGE ?= ${IMAGE_PREFIX}${IMAGE_NAME}:${IMAGE_TAG} | ||
|
|
||
| # Define the patch template | ||
| define PATCH_TEMPLATE | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: controller-manager | ||
| namespace: system | ||
| spec: | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: manager | ||
| env: | ||
| - name: ARGOCD_IMAGE_UPDATER_IMAGE | ||
| value: $(ARGOCD_IMAGE_UPDATER_IMAGE) | ||
| endef | ||
| export PATCH_TEMPLATE | ||
|
|
||
| # Tools - assuming they are in the path or in the project's bin directory | ||
| KUSTOMIZE ?= $(CURDIR)/../../bin/kustomize | ||
| KUBECTL ?= kubectl | ||
| K3D ?= k3d | ||
|
|
||
| K3D_CLUSTER_NAME ?= test-e2e-local | ||
|
|
||
| ifndef ignore-not-found | ||
| ignore-not-found = false | ||
| endif | ||
|
|
||
| .PHONY: deploy-argocd-operator undeploy-argocd-operator kustomize test-e2e-local test-e2e-ci k3d-cluster-create k3d-cluster-delete k3d-image-import | ||
| kustomize: | ||
| $(MAKE) -C ../../ kustomize | ||
|
|
||
| deploy-argocd-operator: kustomize ## Deploy argocd-operator from a stable git reference. | ||
| @echo "Deploying Argo CD Operator..." | ||
| @set -e; \ | ||
| TMP_DIR=$$(mktemp -d); \ | ||
| cp prereqs/kustomization.yaml $$TMP_DIR/kustomization.yaml; \ | ||
| echo "Applying argocd-operator manifests with image $(ARGOCD_OPERATOR_IMAGE)..."; \ | ||
| echo "Setting argocd-image-updater image to $(ARGOCD_IMAGE_UPDATER_IMAGE)..."; \ | ||
| echo "$$PATCH_TEMPLATE" > $$TMP_DIR/patch.yaml; \ | ||
| cd $$TMP_DIR && \ | ||
| $(KUSTOMIZE) edit set image quay.io/argoprojlabs/argocd-operator=$(ARGOCD_OPERATOR_IMAGE) && \ | ||
| $(KUSTOMIZE) edit add patch --path patch.yaml; \ | ||
| $(KUSTOMIZE) build $$TMP_DIR | $(KUBECTL) apply --server-side=true -f -; \ | ||
| rm -rf $$TMP_DIR; \ | ||
| echo "Argo CD Operator deployment initiated."; | ||
|
|
||
| undeploy-argocd-operator: kustomize ## Undeploy argocd-operator. | ||
| @echo "Undeploying Argo CD Operator..." | ||
| @set -e; \ | ||
| TMP_DIR=$$(mktemp -d); \ | ||
| cp prereqs/kustomization.yaml $$TMP_DIR/kustomization.yaml; \ | ||
| $(KUSTOMIZE) build $$TMP_DIR | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -; \ | ||
| rm -rf $$TMP_DIR; \ | ||
| echo "Argo CD Operator undeployment initiated."; | ||
|
|
||
| k3d-cluster-create: ## Create k3d cluster for e2e tests | ||
| @echo "--- Creating k3d cluster $(K3D_CLUSTER_NAME) ---" | ||
| $(K3D) cluster create $(K3D_CLUSTER_NAME) | ||
|
|
||
| k3d-cluster-delete: ## Delete k3d cluster for e2e tests | ||
| @echo "--- Deleting k3d cluster $(K3D_CLUSTER_NAME) ---" | ||
| $(K3D) cluster delete $(K3D_CLUSTER_NAME) | ||
|
|
||
| k3d-image-import: ## Import local image to k3d cluster | ||
| @echo "--- Importing image $(ARGOCD_IMAGE_UPDATER_IMAGE) to k3d cluster $(K3D_CLUSTER_NAME) ---" | ||
| $(K3D) image import $(ARGOCD_IMAGE_UPDATER_IMAGE) -c $(K3D_CLUSTER_NAME) | ||
|
|
||
| # Currently run only parallel tests because we don't have sequential tests yet. | ||
| test-e2e-local: ## Build local image updater, deploy operator, and run parallel e2e tests. | ||
| @echo "--- Creating k3d cluster---" | ||
| $(MAKE) k3d-cluster-create | ||
| @echo "--- Building local argocd-image-updater image ---" | ||
| $(MAKE) -C ../../ docker-build | ||
| @echo "--- Importing image to k3d cluster ---" | ||
| $(MAKE) k3d-image-import | ||
| @echo "--- Deploying argocd-operator with local image-updater ---" | ||
| $(MAKE) deploy-argocd-operator | ||
| @echo "--- Waiting for argocd-operator to be ready ---" | ||
| $(KUBECTL) wait --for=condition=available --timeout=300s deployment/argocd-operator-controller-manager -n argocd-operator-system | ||
| @echo "--- Running Parallel E2E tests ---" | ||
| $(MAKE) -C ../../ e2e-tests-parallel-ginkgo | ||
| @echo "--- Deleting k3d cluster ---" | ||
| $(MAKE) k3d-cluster-delete | ||
|
|
||
| test-e2e-ci: ## Build local image updater, deploy operator. | ||
| @echo "--- Building local argocd-image-updater image ---" | ||
| $(MAKE) -C ../../ docker-build | ||
| @echo "--- Importing image to k3d cluster ---" | ||
| $(MAKE) k3d-image-import | ||
| @echo "--- Deploying argocd-operator with local image-updater ---" | ||
| $(MAKE) deploy-argocd-operator | ||
| @echo "--- Waiting for argocd-operator to be ready ---" | ||
| $(KUBECTL) wait --for=condition=available --timeout=300s deployment/argocd-operator-controller-manager -n argocd-operator-system |
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.
🧩 Analysis chain
🏁 Script executed:
Repository: argoproj-labs/argocd-image-updater
Length of output: 212
🏁 Script executed:
Repository: argoproj-labs/argocd-image-updater
Length of output: 212
🏁 Script executed:
Repository: argoproj-labs/argocd-image-updater
Length of output: 212
🏁 Script executed:
Repository: argoproj-labs/argocd-image-updater
Length of output: 212
🌐 Web query:
k3d cluster creation timeout k3s CI environment typical duration💡 Result:
Typical k3d cluster creation times in CI
Practical recommendation for CI
Sources
🌐 Web query:
k3d install script curl error handling CI workflow best practices💡 Result:
Here are concise, CI-focused best practices for installing k3d with curl (and for handling curl-based install scripts generally), with concrete safety and reliability recommendations.
Quick summary (short checklist)
Concrete examples / patterns
Safer pattern (download + verify + run):
(Use GPG verification if project publishes signatures.) [3][2] (checksum.sh)
CI config tips
Security & reliability rationale (short)
References
[1] k3d install options, prefer packaged/binary and how to pin TAG. (github.com)
[2] curl security/known risks and recommended TLS/options and fail behavior. (curl.se)
[3] checksum.sh / pattern for verifying install scripts before piping to shell. (checksum.sh)
[4] Security analysis on external dependencies in CI and why pin+verify matters. (securing.pl)
[5] Practical Dockerfile/CI advice: avoid piping curl into bash; download & verify instead. (protsenko.dev)
If you want, I can:
Citations:
🌐 Web query:
GitHub Actions job timeout minutes kubernetes k3d setup typical values💡 Result:
GitHub Actions default job timeout: 360 minutes (6 hours). [1][2]
Typical timeout-minutes to use for k3d-based CI:
Notes / tips:
Sources: GitHub Actions timeout docs/cheatsheet and guides; k3d examples; community recommendations. [1][2][3][4]
Add job timeout and improve k3d install error handling.
The workflow lacks explicit timeout protection for long-running operations. The k3d install step uses only
set -xwithoutset -e, so ifcurlfails, the job proceeds with a missing k3d binary, causing delayed failure detection. Additionally,curl -ssilently masks HTTP errors.Add a job timeout and fix error handling in the k3d install step. Based on typical k3d multi-server cluster creation (5–6 minutes with image pulls), test execution, and operator startup, a 30-minute timeout is reasonable but should be tuned to your actual measured runtime.
Apply this diff:
test-e2e: name: Run end-to-end tests runs-on: ubuntu-latest + timeout-minutes: 30 strategy: matrix: k3s-version: [ v1.27.1 ] steps: - name: Install K3D run: | - set -x - curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash + set -ex + curl -fsSL https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash sudo mkdir -p $HOME/.kube && sudo chown -R runner $HOME/.kube k3d cluster create --servers 3 --image rancher/k3s:${{ matrix.k3s-version }}-k3s1 kubectl version k3d versionThe
-fflag oncurlmakes it fail on HTTP errors (4xx/5xx), and-Lfollows redirects. For multi-server clusters, also consider adding--timeout 300to thek3d cluster createcommand to prevent indefinite hangs if networking issues occur.📝 Committable suggestion
🤖 Prompt for AI Agents