refactor(e2e): Extract shared Make infrastructure into e2e.common.mk#3136
refactor(e2e): Extract shared Make infrastructure into e2e.common.mk#3136LeelaChacha wants to merge 7 commits intokyma-project:mainfrom
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the E2E test Make infrastructure by extracting shared boilerplate (tooling, cluster lifecycle, logging) into a common include file and introducing a wrapper script to standardize per-version ModuleTemplate preparation/deployment.
Changes:
- Added
tests/e2e/e2e.common.mkto centralize shared E2E Make targets and variables (tools, clusters, logging). - Simplified
mandatory_module_test.mkandmandatory_modules_metrics_test.mkto mostly test-specific orchestration using the shared include. - Added
scripts/tests/deploy_moduletemplate_e2e.shto encapsulate repeated ModuleTemplate prep/deploy steps behind flags.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
tests/e2e/e2e.common.mk |
New shared Make include for tool install, cluster lifecycle, and helper targets. |
tests/e2e/mandatory_module_test.mk |
Refactored to include common Make logic and use the new wrapper script for module template setup. |
tests/e2e/mandatory_modules_metrics_test.mk |
Refactored similarly to use the common Make logic and wrapper script. |
tests/e2e/e2e_test_template.mk |
New template Makefile intended for creating future E2E Makefiles using the new structure. |
scripts/tests/deploy_moduletemplate_e2e.sh |
New wrapper script for per-version module template preparation and delegation to deploy_moduletemplate.sh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the E2E test Make infrastructure by extracting duplicated boilerplate from the mandatory-module Makefiles into a shared e2e.common.mk, and introduces a wrapper script to standardize per-version module template deployment.
Changes:
- Add
tests/e2e/e2e.common.mkto centralize shell/Go setup, tool versions/install, cluster lifecycle, and helpers. - Simplify
mandatory_module_test.mkandmandatory_modules_metrics_test.mkto mostly test-specific targets and delegate template deployment to a new script. - Add
scripts/tests/deploy_moduletemplate_e2e.shto wrap repeated “set tag/build manifests/rename deployment/deploy template” steps behind flags.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e/e2e.common.mk | New shared Make infrastructure for E2E runs (tooling + cluster lifecycle + helpers). |
| tests/e2e/mandatory_module_test.mk | Refactored to include common mk and delegate module template setup to script. |
| tests/e2e/mandatory_modules_metrics_test.mk | Same refactor pattern as mandatory-module, with a slimmer test-run target. |
| tests/e2e/e2e_test_template.mk | New template Makefile for future E2E suites based on the shared common mk. |
| scripts/tests/deploy_moduletemplate_e2e.sh | New wrapper script for per-version module template preparation and deployment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
1. Add check for directories existing 2. Introduce common variable for module-setup
The E2E test Makefiles for
mandatory-moduleandmandatory-module-metricseach duplicated ~180 lines of boilerplate: Go/shell setup, tool version variables, install targets (ginkgo-install,kustomize-install, etc.), cluster lifecycletargets (
create-clusters,deploy-klm,teardown), and a log-tool-versions helper.This PR extracts all shared infrastructure into a single included file and introduces a thin wrapper script for per-version module template setup.
Changes:
tests/e2e/e2e.common.mk(new) — single source of truth for shell config (.ONESHELL, bash, pipefail), Go/FIPS setup, directory variables, tool version variables, all install targets, cluster lifecycle targets, and log-tool-versions. Also, tool-install targets now skip re-installation if the binary already exists.tests/e2e/mandatory_module_test.mk— reduced from ~225 lines to ~47. Now only contains test-specific targets:klm-patch,module-setup,test-run,clean-test-artifacts,test. Module template setup is delegated to the newdeploy_moduletemplate_e2e.shscript instead of being inlined.tests/e2e/mandatory_modules_metrics_test.mk— reduced from ~204 lines to ~38 lines. Same structure asmandatory_module_test.mk. test-run prerequisites trimmed to log-tool-versions only; kubeconfig exports are inlined in the recipe body consistent with the other test file.scripts/tests/deploy_moduletemplate_e2e.sh(new) — wraps the per-version boilerplate (set image tag in kustomization, make build-manifests, rename Deployment, delegate to deploy_moduletemplate.sh) behind a named-flag interface replacing ~25 lines of inline Make recipe per call site.