Skip to content

Commit 02eeb9e

Browse files
committed
ci(e2e): keep the cozystack-engine ordering edge out of test-impact selection
Every *-application source declares dependsOn cozystack.cozystack-engine so its *-rd HelmRelease waits for the ApplicationDefinition CRD to register before it reconciles. That is a universal install-ordering edge, not a behavioral one. The test-impact selector reused the same dependsOn graph to pick which e2e app suites to run for a diff. Because the engine transitively depends on postgres-operator, keycloak and cert-manager, a change to any of those fanned out through the engine to every app, defeating test-impact analysis. Exclude cozystack.cozystack-engine as a propagation hub in the reverse-dep walk so the engine stays reachable but no longer pushes selection to its app-dependents. A change to the engine itself still triggers the full suite via the existing no-app-descendants safety net. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent fd6e121 commit 02eeb9e

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎hack/select-e2e.sh‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,21 @@ build_owners_index() {
4343
}
4444

4545
# yq: PackageSource name -> sources that depend on it (reverse of dependsOn)
46+
#
47+
# Exclude cozystack.cozystack-engine as a propagation hub. Every *-application
48+
# source declares `dependsOn: cozystack.cozystack-engine` purely as an INSTALL
49+
# ORDERING edge — the app's *-rd HelmRelease must wait for the engine to
50+
# register the ApplicationDefinition CRD before it can reconcile. That is a
51+
# universal lifecycle dependency, NOT a behavioral one: a change to an engine
52+
# dependency (postgres-operator, keycloak, cert-manager, ...) does not alter any
53+
# app's runtime behavior, so it must not fan test selection out to every app.
54+
# Without this filter, postgres-operator -> keycloak -> cozystack-engine -> EVERY
55+
# app, defeating test-impact analysis. Dropping the engine reverse edges keeps
56+
# the engine reachable but stops it propagating selection downstream. A change to
57+
# the engine itself still triggers the full suite via the no-app-descendants
58+
# safety-net at the bottom of this script.
4659
build_reverse_deps() {
47-
yq -rN '.metadata.name as $n | .spec.variants[]?.dependsOn[]? | select(. != null and . != "") | . + "\t" + $n' "$SOURCES_DIR"/*.yaml
60+
yq -rN '.metadata.name as $n | .spec.variants[]?.dependsOn[]? | select(. != null and . != "" and . != "cozystack.cozystack-engine") | . + "\t" + $n' "$SOURCES_DIR"/*.yaml
4861
}
4962

5063
OWNERS=$(build_owners_index | sort -u)

‎hack/select-e2e_test.bats‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@
3737
fi
3838
}
3939

40+
@test "engine-dependency change does not fan out via the ordering edge" {
41+
# cert-manager is a dependency of cozystack-engine, and every app declares
42+
# dependsOn cozystack-engine purely as an INSTALL-ORDERING edge (the app's
43+
# *-rd HelmRelease waits for the ApplicationDefinition CRD). That edge must
44+
# not propagate test selection: a cert-manager change selects only its
45+
# genuine direct dependents (postgres, harbor, ...), never unrelated apps
46+
# like kafka that reach cert-manager solely through the engine.
47+
tmp=$(mktemp -d)
48+
trap 'rm -rf "$tmp"' EXIT
49+
cp -r packages/core/platform/sources "$tmp/sources"
50+
echo "packages/system/cert-manager/values.yaml" > "$tmp/diff"
51+
output=$(hack/select-e2e.sh "$tmp/diff" "$tmp/sources")
52+
echo "$output" | grep -wq postgres
53+
echo "$output" | grep -wq harbor
54+
if echo "$output" | grep -wq kafka; then
55+
echo "cert-manager change must not fan out via engine; got: $output" >&2
56+
exit 1
57+
fi
58+
}
59+
4060
@test "networking change triggers full suite" {
4161
tmp=$(mktemp -d)
4262
trap 'rm -rf "$tmp"' EXIT

0 commit comments

Comments
 (0)