From 94feddd3bf522dc0f4e4dd5fee0f5702914a4f91 Mon Sep 17 00:00:00 2001 From: Rafael Zago Date: Wed, 9 Apr 2025 14:41:57 -0300 Subject: [PATCH 1/4] Add test targets for running specific, e2e, subset, and CI tests --- Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile b/Makefile index 57a30770f..63c7d64e0 100644 --- a/Makefile +++ b/Makefile @@ -183,3 +183,19 @@ clean: cover.out oci-archives bundle bundle.Dockerfile \ skupper-*.tgz artifacthub-repo.yml \ network-observer-*.tgz skupper-*-scope.yaml + +# Run a specific test +test: + $(MAKE) -C tests/ test TEST="$(TEST)" + +# Run all e2e tests +test-e2e: + $(MAKE) -C tests/ e2e-tests + +# Run a subset of tests in parallel +test-subset: + $(MAKE) -C tests/ test-subset TESTS="$(TESTS)" + +# Run CI tests +test-ci: + $(MAKE) -C tests/ ci-tests \ No newline at end of file From 4cf39555a81086798f6bb787ceef1354227a4224 Mon Sep 17 00:00:00 2001 From: Rafael Zago Date: Thu, 10 Apr 2025 09:57:15 -0300 Subject: [PATCH 2/4] Refactor test commands in Makefile for flexibility and update README with high availability test details --- Makefile | 19 +++++-------------- tests/README.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 63c7d64e0..b1c9b54cb 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,10 @@ DOCKER := docker SKOPEO := skopeo PODMAN := podman +# The default e2e test type is set to "ci-tests" if not provided +TEST_TYPE ?= ci-tests +TEST_OPTIONS ?= "" + all: skupper controller kube-adaptor network-observer basepkg = github.com/skupperproject/skupper @@ -184,18 +188,5 @@ clean: skupper-*.tgz artifacthub-repo.yml \ network-observer-*.tgz skupper-*-scope.yaml -# Run a specific test -test: - $(MAKE) -C tests/ test TEST="$(TEST)" - -# Run all e2e tests test-e2e: - $(MAKE) -C tests/ e2e-tests - -# Run a subset of tests in parallel -test-subset: - $(MAKE) -C tests/ test-subset TESTS="$(TESTS)" - -# Run CI tests -test-ci: - $(MAKE) -C tests/ ci-tests \ No newline at end of file + $(MAKE) -C tests/ $(TEST_TYPE) $(TEST_OPTIONS) \ No newline at end of file diff --git a/tests/README.md b/tests/README.md index c91f1c32d..04fea4de3 100644 --- a/tests/README.md +++ b/tests/README.md @@ -24,6 +24,7 @@ tests/ │ ├── hello-world/ # Basic Skupper functionality test │ ├── attached-connector/ # Network performance test with attached connectors │ ├── redis/ # Redis test +│ ├── ha/ # High availability test └── README.md # This file ``` @@ -36,6 +37,7 @@ The `e2e` directory contains tests that validate Skupper functionality across di - **[hello-world](e2e/hello-world/)**: A simple test to verify basic Skupper functionality by deploying frontend and backend components across Skupper sites. - **[attached-connector](e2e/attached-connector/)**: A test to validate Skupper connectivity using attached connectors, including network performance testing with iperf3. - **[redis](e2e/redis/)**: A test to validate Skupper functionality with Redis, including data persistence and replication. +- **[ha](e2e/ha/)**: A test to validate Skupper high availability features, including automatic failover and recovery. ## Adding a new E2E test to be run on CI @@ -94,6 +96,8 @@ make test TEST="hello-world" 2. **Available Make Commands**: +This works for the command being used INSIDE the `/tests` directory. The Makefile will automatically create a virtual environment and install all required dependencies. + ```bash # Create or refresh the virtual environment make create-venv FORCE=true @@ -116,6 +120,8 @@ make ci-tests ### Example summary +This works for the command being used INSIDE the `/tests` directory. The Makefile will automatically create a virtual environment and install all required dependencies. + ```bash # Create a new virtual environment make create-venv FORCE=true @@ -133,6 +139,36 @@ make test-subset TESTS=hello-world,attached-connector make ci-tests ``` +## Running Tests from the ROOT of the Repository + +The root of the repository contains a main Makefile that abstracts and simplifies the process of running tests. This Makefile acts as a wrapper, delegating specific commands to the Makefile located in the `tests` directory. By using the main Makefile, you can execute test-related commands from the root of the repository without needing to navigate into the `tests` directory manually. It ensures that all necessary dependencies and configurations are properly handled before invoking the corresponding commands in the `tests` Makefile. + +### Variables explained + +- **TEST_TYPE**: The type of test to run (e.g., `ci-tests`, `e2e-tests`, `test-subset`, `test`). +- **TEST_OPTIONS**: Additional options to pass to the test command (e.g., `TEST=hello-world`) or `TESTS=hello-world,attached-connector`). +- **FORCE**: Force the creation of a new virtual environment, even if one already exists. + +### Available Commands + +For example: + +```bash +# Run the ci-tests subset from the root +make tests-e2e ci-tests + +# Run all E2E tests from the root +make tests-e2e e2e-tests + +# Run a specific test from the root +make test-e2e TEST_TYPE=test TEST_OPTIONS="TEST=hello-world" + +# Run a specific test with a subset of tests from the root +make test-e2e TEST_TYPE=test-subset TEST_OPTIONS="TESTS=hello-world,attached-connector" +``` + +This abstraction ensures a consistent and streamlined workflow for running tests across the repository. + ## Core Ansible Collections The tests rely on the following Ansible collections: From efb35d0dbc2fb2b9484480e76a51c450f5238a5c Mon Sep 17 00:00:00 2001 From: Rafael Zago Date: Thu, 10 Apr 2025 12:04:17 -0300 Subject: [PATCH 3/4] Update E2E test command in CircleCI to use 'make test-e2e ci-tests' for improved clarity --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d4265b5a7..1e5c4c990 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -311,9 +311,8 @@ jobs: name: Running E2E Tests command: | set -x - cd tests cp ~/kc.west ~/.kube/config - make ci-tests + make test-e2e ci-tests generate-manifest: executor: From 1373f40f50c20db8ecbf20f93b3d42a58f7130ca Mon Sep 17 00:00:00 2001 From: Rafael Zago Date: Thu, 10 Apr 2025 14:25:34 -0300 Subject: [PATCH 4/4] Update E2E test command in CircleCI to change directory before running tests --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1e5c4c990..e7dedea81 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -312,7 +312,8 @@ jobs: command: | set -x cp ~/kc.west ~/.kube/config - make test-e2e ci-tests + cd tests + make ci-tests generate-manifest: executor: