You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(bdd): prototype portable live smoke composition
Add a target-driven live suite with explicit provider and smoke phases, bounded retry and compensation primitives, and a portable cluster-maintenance example.
Relates to #1186
Signed-off-by: Stephanie Baum <sbaum@nvidia.com>
Copy file name to clipboardExpand all lines: tests/bdd/PLAN.md
+29-9Lines changed: 29 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,8 @@ refactor in every consumer; that is a feature.
119
119
|`When I run command:` (docstring) | Multi-line form for commands that don't fit on one line. Same recording semantics. |
120
120
|`When I successfully run command {string}`| Single-line command that must exit 0. Preserves the command result for later output assertions and records the resolved command in the successful-command cache. |
121
121
|`When I successfully run command:` (docstring) | Multi-line form for commands that must exit 0. Uses the same result recording, interpolation, logging, and cache semantics as the single-line form. |
122
+
|`And after this scenario I successfully run command within {string}:` (docstring) | Registers the visible command as bounded scenario compensation. Compensations run in reverse registration order after success or failure, continue past failures, and preserve product behavior in the command text. |
123
+
|`Then within {string} this command should succeed, checking every {string}:` (docstring) | Repeats the visible command after product-level nonzero exits until it exits 0 or the visible timeout expires. Runner failures stop immediately. The successful result remains available to output assertions. |
122
124
|`When I run command with a terminal:` (docstring) | Same as the docstring form, but stdin is attached to a pseudo-terminal so the child sees a TTY on fd 0. For commands that gate interactive-only behavior on a TTY, such as `nvcf-cli self-hosted up` (its auth-gate mints the admin token only when stdin is a terminal). No input is written; stdout and stderr are captured separately as usual. |
123
125
|`When I export command output to environment variable {string}`| Exports the previous command's trimmed stdout under the named env var. Fails the step unless the prior command exited 0 and produced non-empty stdout. Snapshotted by the env Ledger; restored at suite teardown. |
124
126
@@ -158,6 +160,7 @@ original order. Repeated options and empty values are preserved.
158
160
|`Then the command exit code should be {int}`| Last-run exit code. |
159
161
|`Then the command output should contain {string}`| Substring match on combined stdout + stderr. |
160
162
|`Then the command output should not contain {string}`| Negative substring match. |
163
+
|`Then the JSON command output should contain:` (JSON docstring) | Parses the last command's stdout and the expected docstring as JSON, then requires the typed expected object fields while allowing additional actual fields. Lists remain order- and length-sensitive. |
161
164
|`Then file {string} should exist`||
162
165
|`Then yaml file {string} key {string} should equal {string}`| Reads the YAML file, walks the dotted key path, compares to the value (with `${VAR}` expansion). |
163
166
|`Then yaml file {string} key {string} should not be empty`| Same key resolution; passes if the resolved value is non-empty. Use for non-deterministic outputs (cluster IDs, identity sources) where exact-value assertions are wrong. |
@@ -206,10 +209,18 @@ them via `${VAR}` in command strings and table cells.
206
209
|`REPO_ROOT`|`git rev-parse --show-toplevel` at suite start | Absolute path to the repo root. Required when invoking `make -C deploy/stacks/self-managed` because the Makefile's `-C` changes cwd; relative paths to fixtures from there break. |
207
210
|`NGC_API_KEY` / `SAMPLE_NGC_ORG` / `SAMPLE_NGC_TEAM`| The operator's shell | Passed through unchanged. An environment-variable precondition step asserts they are non-empty before any scenario uses them. |
208
211
212
+
The portable live runner additionally maps its selected target to stable
213
+
`BDD_NVCF_*`, `BDD_COMPUTE_*`, `BDD_NVCA_*`, and `BDD_WORKLOAD_*` variables.
214
+
It runs each selected feature separately and restores step-exported environment
215
+
variables and ledger-backed file changes between features. CLI state and the
216
+
successful bootstrap command cache remain suite-scoped. See `live/README.md`
217
+
for the target schema and safety contract.
218
+
209
219
Feature files may also export their own env vars at runtime via
210
220
`When I export command output to environment variable {string}`. Those
211
-
are snapshotted by the env Ledger and restored at teardown so they do
212
-
not leak into later test binaries in the same `go test` invocation.
221
+
are snapshotted by the env Ledger and restored at teardown. The portable live
222
+
runner restores them after each selected feature so they cannot become an
223
+
implicit input to another smoke.
213
224
The EKS Helmfile feature exports `EKS_GATEWAY_ADDR` this way from
214
225
`kubectl get gateway` after the Gateway resource is Programmed.
215
226
@@ -255,8 +266,9 @@ restoration ledger:
255
266
body, mode) in memory. Repeat writes against the same path during a
256
267
suite do not overwrite the snapshot; only the first write records.
257
268
- At suite teardown, the runner restores every registered path to its
258
-
pre-suite state. Files that did not exist before are deleted; files
259
-
that did are rewritten with the original bytes and mode.
269
+
pre-suite state. The portable live runner performs the same restoration
270
+
between selected features. Files that did not exist before are deleted;
271
+
files that did are rewritten with the original bytes and mode.
260
272
-`Config.LedgerDir` (`out/<run-id>/originals/`) is reserved for an
261
273
on-disk variant if very large fixtures ever push memory limits.
0 commit comments