From 92cf9dae6f2165db8c5af3048dc90d42e3915e70 Mon Sep 17 00:00:00 2001 From: Danilo Hashimoto <97529980+hash-d@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:52:51 -0300 Subject: [PATCH 1/4] allow definition of TEST_PREFIX, PYTHON binary, additional OPTIONS; fix - The fix is the removal of the duplicated creation of workloads on both namespaces --- tests/Makefile | 17 +++++++++++---- tests/README.md | 21 ++++++++++++++++++- .../roles/generate_namespaces/tasks/main.yml | 1 + tests/e2e/scenarios/hello-world/test.yml | 4 ++++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 82ad56400..caac6f8ac 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,9 +1,17 @@ ROOT_PATH := $(shell pwd) EXTRA_VARS := --extra-vars "@$(ROOT_PATH)/vars.yml" COLLECTION_PATH := $(ROOT_PATH)/e2e/collections/ansible_collections/e2e/tests + # Remove expose-pods-by-name from the CI tests, until we close # this issue https://github.com/skupperproject/skupper/issues/2251 TESTS_CI := attached-connector,ha,hello-world,labels-and-annotations +PYTHON ?= python3 + +# The caller may set a TEST_PREFIX, so they can deal with all namespaces created +# by these tests with -l e2e.prefix=$TEST_PREFIX. If not set, we create a random one +RANDOM != echo $$RANDOM +TEST_PREFIX ?= $(RANDOM) +export TEST_PREFIX # E2E Test directories E2E_TEST_DIRS := $(sort $(wildcard $(ROOT_PATH)/e2e/scenarios/*)) @@ -15,7 +23,7 @@ create-venv: echo "Removing old environment if it exists..."; \ rm -rf /tmp/e2e-venv; \ echo "Creating virtual environment..."; \ - cd /tmp && python3 -m venv e2e-venv; \ + cd /tmp && $(PYTHON) -m venv e2e-venv; \ if [ -d "/tmp/e2e-venv" ]; then \ echo "Virtual environment created successfully at /tmp/e2e-venv"; \ . /tmp/e2e-venv/bin/activate && \ @@ -60,15 +68,16 @@ test: create-venv exit 1; \ fi - @export TEST_PREFIX=$$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 5 | head -n 1); \ - echo "Running the test for directory: $(TEST) with prefix: $$TEST_PREFIX"; \ + @echo "Running the test for directory: $(TEST) with prefix: $(TEST_PREFIX)"; + . /tmp/e2e-venv/bin/activate && \ mkdir -p /tmp/e2e/$(TEST) && \ ANSIBLE_LOG_PATH=/tmp/e2e/$(TEST)/ansible_$$(date +%Y%m%d_%H%M%S).log \ ANSIBLE_CONFIG=$(ROOT_PATH)/e2e/ansible.cfg \ ansible-playbook $(ROOT_PATH)/e2e/scenarios/$(TEST)/test.yml \ -i $(ROOT_PATH)/e2e/scenarios/$(TEST)/inventory $(EXTRA_VARS) \ - -e namespace_prefix=$$TEST_PREFIX -e test_name=$$TEST; \ + $(OPTIONS) \ + -e namespace_prefix=$(TEST_PREFIX) -e test_name=$$TEST; \ EXIT_CODE=$$?; \ if [ $$EXIT_CODE -ne 0 ]; then \ echo "Test $(TEST) failed with exit code $$EXIT_CODE"; \ diff --git a/tests/README.md b/tests/README.md index 96a97107d..1d7d99133 100644 --- a/tests/README.md +++ b/tests/README.md @@ -19,7 +19,7 @@ Note: If you are running the tests from the Makefile, this is not needed, as the ``` tests/ -├── e2e/ +├── e2e/ ├── scenarios/ # End-to-end tests directory │ ├── hello-world/ # Basic Skupper functionality test │ ├── attached-connector/ # Network performance test with attached connectors @@ -164,6 +164,25 @@ make test-subset TESTS="test1,test2" make ci-tests ``` +3. **Make variables** + +The following `make` variables are available: + +* `OPTIONS` will provide additional options to the `ansible-playbook` invocation. + + `make e2e-tests OPTIONS="-v"` + +* `PYTHON` allows the `venv` to be created with a specific Python binary + + `make create-venv PYTHON=python3.12` + +* `TEST_PREFIX` allows one to select a prefix to be added to the name of the tests' namespaces: + + `make e2e-tests TEST_PREFIX=123` + + By default, a random prefix is generated for each run. The namespaces can be selected on Kubernetes + with the label `e2e.prefix`, allowing for easy removal of failed tests, for example. + ### Example summary ```bash diff --git a/tests/e2e/collections/ansible_collections/e2e/tests/roles/generate_namespaces/tasks/main.yml b/tests/e2e/collections/ansible_collections/e2e/tests/roles/generate_namespaces/tasks/main.yml index fd889f595..00bd10b2b 100644 --- a/tests/e2e/collections/ansible_collections/e2e/tests/roles/generate_namespaces/tasks/main.yml +++ b/tests/e2e/collections/ansible_collections/e2e/tests/roles/generate_namespaces/tasks/main.yml @@ -10,6 +10,7 @@ name: "{{ namespace_prefix }}-{{ namespace_name }}" labels: e2e.id: "{{ generate_namespaces_namespace_label }}" + e2e.prefix: "{{ namespace_prefix }}" kubeconfig: "{{ kubeconfig }}" register: namespace_result diff --git a/tests/e2e/scenarios/hello-world/test.yml b/tests/e2e/scenarios/hello-world/test.yml index a25aefe81..d33504648 100644 --- a/tests/e2e/scenarios/hello-world/test.yml +++ b/tests/e2e/scenarios/hello-world/test.yml @@ -17,11 +17,15 @@ include_tasks: skupper-sites.yml vars: site_name: west + when: + - "'west' in inventory_hostname" - name: Create Skupper resources for east site include_tasks: skupper-sites.yml vars: site_name: east + when: + - "'east' in inventory_hostname" - name: Issue a Skupper access token from west namespace skupper.v2.token: From 2d0c9936cb778a4fbcac5a9998e203d5e5582954 Mon Sep 17 00:00:00 2001 From: Danilo Hashimoto <97529980+hash-d@users.noreply.github.com> Date: Fri, 5 Jun 2026 17:35:24 -0300 Subject: [PATCH 2/4] Update with removal of 'v2' branch from redis example --- tests/e2e/scenarios/redis/README.md | 24 ++++++++++++------------ tests/e2e/scenarios/redis/test.yml | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/e2e/scenarios/redis/README.md b/tests/e2e/scenarios/redis/README.md index 72d94b839..e4351c27b 100644 --- a/tests/e2e/scenarios/redis/README.md +++ b/tests/e2e/scenarios/redis/README.md @@ -100,10 +100,10 @@ kubeconfig: "{{ kubeconfig_1 }}" namespace_name: redis-west # West CRs -site: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/west-crs/site-west.yaml" -connector: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/west-crs/connector-west.yaml" -listener: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/west-crs/listener-west.yaml" -redis: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/west-crs/redis-west.yaml" +site: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/west-crs/site-west.yaml" +connector: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/west-crs/connector-west.yaml" +listener: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/west-crs/listener-west.yaml" +redis: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/west-crs/redis-west.yaml" ``` #### East Cluster (host_vars/east.yml) @@ -117,10 +117,10 @@ kubeconfig: "{{ kubeconfig_2 }}" namespace_name: redis-east # East CRs -site: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/east-crs/site-east.yaml" -connector: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/east-crs/connector-east.yaml" -listener: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/east-crs/listener-east.yaml" -redis: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/east-crs/redis-east.yaml" +site: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/east-crs/site-east.yaml" +connector: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/east-crs/connector-east.yaml" +listener: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/east-crs/listener-east.yaml" +redis: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/east-crs/redis-east.yaml" ``` #### North Cluster (host_vars/north.yml) @@ -134,10 +134,10 @@ kubeconfig: "{{ kubeconfig_3 }}" namespace_name: redis-north # North CRs -site: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/north-crs/site-north.yaml" -connector: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/north-crs/connector-north.yaml" -listener: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/north-crs/listener-north.yaml" -redis: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/north-crs/redis-north.yaml" +site: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/north-crs/site-north.yaml" +connector: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/north-crs/connector-north.yaml" +listener: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/north-crs/listener-north.yaml" +redis: "https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/north-crs/redis-north.yaml" ``` ### Other Key Variables diff --git a/tests/e2e/scenarios/redis/test.yml b/tests/e2e/scenarios/redis/test.yml index 0a880abe8..3df51c723 100644 --- a/tests/e2e/scenarios/redis/test.yml +++ b/tests/e2e/scenarios/redis/test.yml @@ -88,8 +88,8 @@ path: "{{ item }}" platform: podman with_items: - - https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/podman-crs/listener-podman.yaml - - https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/v2/podman-crs/site-podman.yaml + - https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/podman-crs/listener-podman.yaml + - https://raw.githubusercontent.com/skupperproject/skupper-example-redis/refs/heads/main/podman-crs/site-podman.yaml - name: "[ {{ test_identifier }} ] - Apply token to podman site" skupper.v2.resource: From eb9463b2b6958180e258754f0e90fb3c9e6a783b Mon Sep 17 00:00:00 2001 From: Danilo Hashimoto <97529980+hash-d@users.noreply.github.com> Date: Sat, 3 Jan 2026 16:47:48 -0300 Subject: [PATCH 3/4] Fix bash/$RANDOM for circleCI --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index caac6f8ac..2ea57c373 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -9,7 +9,7 @@ PYTHON ?= python3 # The caller may set a TEST_PREFIX, so they can deal with all namespaces created # by these tests with -l e2e.prefix=$TEST_PREFIX. If not set, we create a random one -RANDOM != echo $$RANDOM +RANDOM := $(shell bash -c 'echo $$RANDOM') TEST_PREFIX ?= $(RANDOM) export TEST_PREFIX From 9ae42a19bd8f61aaaa97cf3c54a6c2624fd627be Mon Sep 17 00:00:00 2001 From: Danilo Hashimoto <97529980+hash-d@users.noreply.github.com> Date: Fri, 5 Jun 2026 17:58:57 -0300 Subject: [PATCH 4/4] Remove expose-pods-by-name from the e2e tests due to #2251 --- tests/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Makefile b/tests/Makefile index 2ea57c373..06d0f3942 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -89,6 +89,7 @@ e2e-tests: @echo "Running all tests in sequence..." @for test_dir in $(E2E_TEST_DIRS); do \ test_name=$$(basename $$test_dir); \ + [ "$$test_name" == "expose-pods-by-name" ] && continue; \ echo "\n=== Running test: $$test_name ==="; \ $(MAKE) test TEST="$$test_name" || exit 1; \ done