@@ -19,6 +19,9 @@ non-technical stakeholders.
1919
2020## Project Structure
2121
22+ Component step packages are introduced incrementally. The layout below shows
23+ their intended ownership after all component extractions land.
24+
2225```
2326test/
2427├── e2e/
3336└── internal/
3437 ├── e2e/
3538 │ ├── runner.go # Godog options, scenario selection, summary wiring
36- │ ├── steps/ # All existing step definitions and hooks
39+ │ ├── steps/ # Shared world, hooks, catalog, resource, RBAC, and condition helpers
3740 │ │ └── testdata/ # RBAC and resource templates
41+ │ ├── operator-controller/steps/ # ClusterExtension lifecycle and integration assertions
42+ │ ├── catalogd/steps/ # HA/proxy/TLS steps and restoration hooks
43+ │ ├── object-controller/steps/ # ClusterObjectSet/Deployment assertions
44+ │ ├── platform/steps/ # Demo steps and recording
3845 │ └── support-bundle.yaml # Shared diagnostics
3946 └── summary/ # Summary generation and embedded templates
4047```
4350
4451### 1. Test Runner (` operator-controller/suite_test.go ` )
4552
46- The component entry point registers the full shared step set and hooks , then calls
53+ The component entry point registers shared steps, hooks, and its component steps , then calls
4754` e2e.Run ` from ` test/internal/e2e ` with its feature directory. The shared runner configures Godog options,
4855scenario selection, and summary generation.
4956
@@ -53,10 +60,22 @@ controller unit tests live under `internal/testutil`, which is accessible throug
5360the repository.
5461
5562Features follow the ownership in the [ per-component suite design] ( ../../docs/designs/e2e-per-component.md ) .
56- Each component has a thin entry point that still registers the full shared step set;
57- step ownership is separated in the next stage. The newer ` cos_* ` , ` cod_* ` , and
58- ` group ` features belong to object-controller. Feature contents and step behavior
59- are unchanged, including ClusterExtension integration assertions in object features.
63+ The newer ` cos_* ` , ` cod_* ` , and ` group ` features belong to object-controller.
64+ Suites register additional component steps when existing features contain integration
65+ assertions: operator-controller uses object assertions, object-controller retains
66+ ClusterExtension integration coverage, and catalogd proxy tests use ClusterExtension
67+ steps. Platform registers ClusterExtension steps for demos. Feature contents,
68+ scenario names, tags, and assertions are unchanged.
69+
70+ ` test/internal/e2e/steps ` owns ` World ` and the ` Scenario(ctx) ` accessor, generic resource and
71+ condition helpers, catalog/registry prerequisites, RBAC templates, and cleanup.
72+ ` ListClusterObjectSetsInGroup ` and ` ResolveObjectRef ` remain shared because
73+ both ClusterExtension and ClusterObjectSet assertions consume them.
74+ Catalogd owns deployment restoration and proxy state. Platform owns recording;
75+ shared helpers observe commands through an optional ` CommandRecorder ` interface.
76+ Pass extra lifecycle registration to ` sharedsteps.RegisterHooks ` to keep suite hooks
77+ between shared scenario setup and cleanup. The upgrade helpers remain shared because
78+ catalogd HA scenarios also consume component readiness and catalog reconciliation steps.
6079
6180### 2. Feature Files (` operator-controller/features/*.feature ` )
6281
@@ -112,7 +131,7 @@ Feature: Install ClusterExtension
112131 And ClusterExtension is available
113132```
114133
115- ### 3. Step Definitions (` test/internal/e2e/steps/steps.go ` )
134+ ### 3. Step Definitions (` test/internal/e2e/<component>/ steps/steps.go ` )
116135
117136Go functions that implement the steps defined in feature files. Each step is registered with a regex pattern that
118137matches the Gherkin text.
@@ -121,9 +140,8 @@ matches the Gherkin text.
121140
122141``` go
123142func RegisterSteps (sc *godog .ScenarioContext ) {
124- sc.Step (` ^OLM is available$` , OLMisAvailable)
125143sc.Step (` ^bundle "([^"]+)" is installed in version "([^"]+)"$` , BundleInstalled)
126- sc.Step (` ^ClusterExtension is applied$` , ResourceIsApplied)
144+ sc.Step (` ^ClusterExtension is applied$` , shared. ResourceIsApplied )
127145// ... more steps
128146}
129147```
@@ -132,7 +150,7 @@ sc.Step(`^ClusterExtension is applied$`, ResourceIsApplied)
132150
133151Status assertions must read metadata and status from the same API response and
134152require the asserted condition's ` observedGeneration ` to equal ` metadata.generation ` .
135- Use ` waitForCondition ` for condition checks. Bundle metadata uses the ` Installed `
153+ Use ` shared.WaitForCondition ` for condition checks. Bundle metadata uses the ` Installed `
136154condition, and COS phase digests and object counts use the ` Ready ` condition to
137155verify that the status reflects the current spec. Deployments instead expose
138156` status.observedGeneration ` at the resource level.
@@ -146,18 +164,18 @@ That step accepts any current-generation `Progressing` status or reason, whereas
146164
147165``` go
148166func BundleInstalled (ctx context .Context , name , version string ) error {
149- sc := scenarioCtx (ctx)
150- waitFor (ctx, func () bool {
151- v , err := k8sClient (ctx, " get" , " clusterextension" , sc.clusterExtensionName , " -o" , " json" )
167+ sc := shared. Scenario (ctx)
168+ shared. WaitFor (ctx, func () bool {
169+ v , err := shared. K8sClient (ctx, " get" , " clusterextension" , sc.ClusterExtensionName , " -o" , " json" )
152170 if err != nil {
153171 return false
154172 }
155173 var ext ocv1.ClusterExtension
156174 if err := json.Unmarshal ([]byte (v), &ext); err != nil {
157175 return false
158176 }
159- installed := currentCondition (ext.Generation , ext.Status .Conditions , ocv1.TypeInstalled )
160- return conditionMatches (installed, metav1.ConditionTrue , nil , nil ) &&
177+ installed := shared. CurrentCondition (ext.Generation , ext.Status .Conditions , ocv1.TypeInstalled )
178+ return shared. ConditionMatches (installed, metav1.ConditionTrue , nil , nil ) &&
161179 ext.Status .Install .Bundle .Name == name && ext.Status .Install .Bundle .Version == version
162180 })
163181 return nil
@@ -199,7 +217,7 @@ Feature: Your Feature Name
199217
200218### 2. Implement Step Definitions
201219
202- Add step implementations in ` test/internal/e2e/steps/steps.go ` :
220+ Add component assertions in ` test/internal/e2e/<component>/ steps/ ` ; add reusable prerequisites and helpers in ` test/internal/e2e/ steps/ ` :
203221
204222``` go
205223func RegisterSteps (sc *godog .ScenarioContext ) {
@@ -208,7 +226,7 @@ func RegisterSteps(sc *godog.ScenarioContext) {
208226}
209227
210228func YourStepFunction (ctx context .Context , param string ) error {
211- sc := scenarioCtx (ctx)
229+ sc := shared. Scenario (ctx)
212230 // Implementation
213231 return nil
214232}
@@ -230,7 +248,7 @@ Use these variables in YAML templates:
230248- ` ${NAME} ` : Scenario-specific ClusterExtension name (e.g., ` ce-123 ` )
231249- ` ${COS_NAME} ` : Scenario-specific ClusterObjectSet name (e.g., ` cos-123 ` ; for applying ClusterObjectSets directly)
232250- ` ${TEST_NAMESPACE} ` : Scenario-specific namespace (e.g., ` ns-123 ` )
233- - ` ${SCENARIO_ID} ` : Unique scenario identifier used for resource name isolation
251+ - ` ${SCENARIO_ID} ` : Feature-scoped scenario identifier used for resource isolation across concurrent Go suites
234252- ` ${PACKAGE:<name>} ` : Parameterized package name (e.g., ` ${PACKAGE:test} ` expands to ` test-<scenario-id> ` )
235253- ` ${CATALOG:<name>} ` : Catalog resource name (e.g., ` ${CATALOG:test} ` expands to ` test-catalog-<scenario-id> ` )
236254
@@ -427,8 +445,12 @@ go test -count=1 ./test/e2e/operator-controller/... -args --log.debug --k8s.cli=
427445
428446Each scenario runs in its own namespace with unique resource names, ensuring complete isolation:
429447
430- - Namespace: ` ns-{scenario-id} `
431- - ClusterExtension: ` ce-{scenario-id} `
448+ - Namespace: ` ns-{feature-hash}-{godog-id} `
449+ - ClusterExtension: ` ce-{feature-hash}-{godog-id} `
450+
451+ Godog restarts numeric IDs in each process. The feature hash prevents collisions
452+ between concurrent component suites and stays stable when a feature moves. Feature
453+ and scenario annotations retain their existing values.
432454
433455### 2. Test-Identifying Annotations
434456
@@ -476,7 +498,7 @@ When ClusterExtension is applied
476498All asynchronous operations use ` waitFor ` with consistent timeout (300s) and tick (1s):
477499
478500``` go
479- waitFor (ctx, func () bool {
501+ shared. WaitFor (ctx, func () bool {
480502 // Check condition
481503 return conditionMet
482504})
0 commit comments