โ ๏ธ Critical Understanding
When you open a PR in infra-deployments, the E2E tests DO NOT run all 7 test suites blindly!
Instead, intelligent rules detect which components changed and run only the relevant tests
plus a baseline "konflux" suite. This is crucial for fast CI and avoiding unnecessary test execution.
๐ Related Guides: Complete Testing Flow |
Understanding Overlays
๐ง Intelligent Test Selection (The Magic!)
๐ฏ Key Concept: Smart Rules Engine
The e2e-tests repository has a built-in rules engine that analyzes which files changed in your
infra-deployments PR and selects appropriate tests. This is NOT random - it's carefully designed!
func RunE2ETests() error {
switch rctx.RepoName {
case "infra-deployments":
return engine.MageEngine.RunRules(rctx, "tests", "infra-deployments")
default:
labelFilter := "!upgrade-create && !upgrade-verify && !upgrade-cleanup && !release-pipelines"
return runTests(labelFilter, "e2e-report.xml")
}
}
๐ The Rules (From Real Code!)
Rule 1: Integration Component Changed
IF: Files changed in components/integration/**/*
THEN run tests with label: integration-service + konflux
Rule 2: Build Service Component Changed
IF: Files changed in components/build-service/**/*
BUT NOT: build-pipeline-config.yaml
THEN run tests with label: build-service + konflux
Rule 3: Build Templates Changed
IF: components/build-service/base/build-pipeline-config/build-pipeline-config.yaml changed
THEN run tests with label: build-templates + konflux
Rule 4: Release Service Component Changed
IF: Files changed in components/release/**/*
THEN run tests with label: release-service + konflux
Rule 5: Multi-Platform Controller Changed
IF: Files changed in components/multi-platform-controller/**/*
THEN run tests with label: multi-platform + konflux
Rule 6: Enterprise Contract Changed
IF: Files changed in components/enterprise-contract/**/*
THEN run tests with label: ec + konflux
Rule 7: Image Controller Changed
IF: Files changed in components/image-controller/**/*
THEN run tests with label: image-controller + konflux
Rule 8: Pipeline Service Changed
IF: Files changed in components/pipeline-service/**/*
THEN run tests with label: pipeline-service + konflux
Default Rule: Other Changes
IF: Changes to files NOT matched by any specific component rule above
THEN run tests with label: konflux only (baseline tests)
var InfraDeploymentsDefaultRule = rulesengine.Rule{
Name: "Infra Deployments Default Test Execution",
Description: "Run the Konflux-demo suite tests when an Infra-deployments PR includes changes to files outside of the specified components.",
Condition: rulesengine.None{
},
Actions: []rulesengine.Action{
rulesengine.ActionFunc(ExecuteInfraDeploymentsDefaultTestAction)
}
}
func ExecuteInfraDeploymentsDefaultTestAction(rctx *rulesengine.RuleCtx) error {
rctx.LabelFilter = "konflux"
return ExecuteTestAction(rctx)
}
๐ Real-World Examples
Example 1: Renovate PR Updates build-service Image
- components/build-service/development/kustomization.yaml
- components/build-service/staging/base/kustomization.yaml
- components/build-service/production/base/kustomization.yaml
โ InfraDeploymentsBuildServiceComponentChangeRule matches!
ginkgo --label-filter="build-service,konflux" ./tests/...
โ tests/build/ (build-service label)
โ tests/konflux-demo/ (konflux label)
โ tests/integration-service/
โ tests/release/
โ tests/enterprise-contract/
โ tests/upgrade/
โ tests/load-tests/
Example 2: Manual PR Updates Monitoring Configuration
- components/monitoring/prometheus/servicemonitor.yaml
- components/monitoring/grafana/dashboard.json
โ NO specific component rules match!
โ InfraDeploymentsDefaultRule applies!
ginkgo --label-filter="konflux" ./tests/...
โ tests/konflux-demo/ (konflux label ONLY)
Example 3: PR Updates Multiple Components
- components/build-service/base/deployment.yaml
- components/integration/base/deployment.yaml
- components/release/base/release-plan.yaml
โ InfraDeploymentsBuildServiceComponentChangeRule matches!
โ InfraDeploymentsIntegrationComponentChangeRule matches!
โ InfraDeploymentsReleaseServiceComponentChangeRule matches!
ginkgo --label-filter="build-service,integration-service,release-service,konflux" ./tests/...
โ tests/build/ (build-service label)
โ tests/integration-service/ (integration-service label)
โ tests/release/ (release-service label)
โ tests/konflux-demo/ (konflux label)