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
{{ message }}
Repository navigation
Commit 13252d5
Browse filesBrowse the repository at this point in the historyBrowse files
acc: remove engine-specific logic from the acceptance harness
The terraform engine is gone, so no test varies DATABRICKS_BUNDLE_ENGINE anymore.
- Drop the engine-aware subset grouping and 10x direct weighting; subset selection
now hashes over all variants.
- Drop the EnvMatrix.DATABRICKS_BUNDLE_ENGINE = [] validation, the terraform
CHECKPOINT_DISABLE env, and the DBR runner's engine ENVFILTER.
- Gate eventual-consistency injection on INJECT_STALE_ON_DIRECT alone. This makes
postgres_synced_tables/recreate_capped exercise the capped wait it was written
for (its golden previously showed a successful recreate).
- read_state.py/print_state.py: drop the terraform-engine branch; print_state.py
decides on DMS recording from the state file, not the engine env var.
- Make engine-conditional test assertions unconditional, drop the dead
permissions direct-vs-terraform comparison, and the terraform-only exclusions in
empty_string_dropped/gen_empty_config.py (fixture and goldens regenerated).
- Update testing rules that described the two-engine matrix.
Co-authored-by: Isaac <no-reply@databricks.com>
Copy file name to clipboardExpand all lines: .agents/rules/testing.md
+6-10Lines changed: 6 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ The whole `Cloud*` family lives inside an `if isRunningOnCloud` branch in `getSk
66
66
67
67
Exception: mass string replacement when the change is predictable and much cheaper than re-running the test suite.
68
68
69
-
**RULE: All `EnvMatrix` variants MUST produce identical output files.**Filenames containing `$DATABRICKS_BUNDLE_ENGINE`(e.g. `output.direct.txt`) are the only per-engine exception.
69
+
**RULE: All `EnvMatrix` variants MUST produce identical output files.**The only exception is a test that sets `EnvVaryOutput`, whose files named after the variant value (e.g. `out.deploy.<value>.txt`) are per-variant.
70
70
71
71
**RULE: Do not run `-update` while a divergent variant exists.** It is destructive: it overwrites with the last variant and breaks the others. To debug: run a single variant you consider correct with `-update`, then debug the other variant to find why it diverges.
**RULE: When output genuinely diverges between engines (terraform vs direct), split only the diverging file into per-engine variants.** Keep the rest of the output unified. Files named `output.$DATABRICKS_BUNDLE_ENGINE.txt` or `out.requests.$DATABRICKS_BUNDLE_ENGINE.json` are the allowed per-engine form.
99
-
100
-
If the only reason for divergence is a server-side default that one engine sets and the other doesn't, set the field explicitly in `databricks.yml` so both engines produce identical output. Don't paper over it with per-engine files.
101
-
102
98
**RULE: On Windows, Git Bash auto-converts a leading-`/` path argument (e.g. `/api/2.0/...`) into a Windows path, so `$CLI` sees the wrong path and the testserver 404s.** Set `Env.MSYS_NO_PATHCONV = "1"` in the test directory's `test.toml`. Quoting the argument in bash does NOT help — the conversion is done by the Windows binary's argument processing. Precedent: `acceptance/cmd/workspace/export-dir-*/test.toml`.
103
99
104
-
**RULE: `EnvMatrix.<VAR> = []` removes that variable from the inherited matrix** (see `ExpandEnvMatrix` in `acceptance/internal/config.go`). The root `test.toml` matrixes `DATABRICKS_BUNDLE_ENGINE = [terraform, direct]`, so a non-bundle test opts out of both engine runs with `EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []`. The `out.test.toml` snapshot of inherited values is generated and committed by design.
100
+
**RULE: `EnvMatrix.<VAR> = []` removes that variable from the inherited matrix** (see `ExpandEnvMatrix` in `acceptance/internal/config.go`). For example, `acceptance/bundle/test.toml` matrixes `DMS = ["", "true"]`, so a bundle test opts out of the DMS run with `EnvMatrix.DMS = []`. The `out.test.toml` snapshot of inherited values is generated and committed by design.
105
101
106
102
**RULE: Write every map-valued setting in dotted form at the top of `test.toml`, never under a table header.** This covers `Env`, `EnvMatrix`, `EnvMatrixExclude`, `EnvRepl`, `GOOS` and `CloudEnvs` — e.g. `Env.MSYS_NO_PATHCONV = "1"`, `GOOS.windows = false`. In TOML every key after a `[EnvMatrix]` header belongs to that table until the next header — a blank line does not end it. So a top-level key like `Ignore` placed below `[EnvMatrix]` is silently parsed as `EnvMatrix.Ignore` (a bogus matrix variable) instead of the real top-level field, and the test runs with the field unset. Dotted form keeps each key's table explicit and is immune to ordering.
107
103
@@ -110,15 +106,15 @@ If the only reason for divergence is a server-side default that one engine sets
110
106
GOOD:
111
107
112
108
```toml
113
-
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]
109
+
EnvMatrix.READPLAN = ["", "1"]
114
110
Ignore = ["databricks.yml"]
115
111
```
116
112
117
113
BAD:
118
114
119
115
```toml
120
116
[EnvMatrix]
121
-
DATABRICKS_BUNDLE_ENGINE = ["direct"]
117
+
READPLAN = ["", "1"]
122
118
123
119
Ignore = ["databricks.yml"] # parsed as EnvMatrix.Ignore, not top-level Ignore
124
120
```
@@ -132,7 +128,7 @@ Ignore = ["databricks.yml"] # parsed as EnvMatrix.Ignore, not top-level Ignore
132
128
- Source files: `test.toml`, `script`, `script.prepare`, `databricks.yml`, etc.
133
129
- Tests are configured via `test.toml`. Config schema and explanation is in `acceptance/internal/config.go`. Certain options are also dumped to `out.test.toml` so that inherited values are visible on PRs.
134
130
- Run a single test: `go test ./acceptance -run TestAccept/bundle/<path>/<to>/<folder>`
135
-
- Run a specific variant by appending `EnvMatrix` values to the test name: `go test ./acceptance -run 'TestAccept/.../DATABRICKS_BUNDLE_ENGINE=direct'`. When there are multiple `EnvMatrix` variables, they appear in alphabetical order.
131
+
- Run a specific variant by appending `EnvMatrix` values to the test name: `go test ./acceptance -run 'TestAccept/.../DMS=true'`. When there are multiple `EnvMatrix` variables, they appear in alphabetical order.
136
132
- Useful flags: `-v` for verbose output, `-tail` to follow test output (requires `-v`), `-logrequests` to log all HTTP requests/responses (requires `-v`).
137
133
- Run tests on cloud: `deco env run -i -n aws-prod-ucws -- <go test command>` (requires `deco` tool and access to test env). This is an *additional* pass over the same test directories, restricted to those with `Cloud = true` set; it does not replace the local run.
138
134
-`script.prepare` files from parent directories are concatenated into the test script. Use them for shared bash helpers.
@@ -183,7 +179,7 @@ Available on `PATH` during test execution (from `acceptance/bin/`):
183
179
-`update_file.py FILENAME OLD NEW`: replace all occurrences of OLD with NEW in FILENAME. Errors if OLD is not found. Cannot be used on `output.txt`.
184
180
-`find.py REGEX [--expect N]`: find files matching regex in current directory. `--expect N` asserts an exact count.
185
181
-`diff.py DIR1 DIR2` or `diff.py FILE1 FILE2`: recursive diff with test replacements applied.
186
-
-`print_state.py [-t TARGET] [--backup]`: print deployment state (terraform or direct).
182
+
-`print_state.py [-t TARGET] [--backup]`: print deployment state (`resources.json`, or a terraform state left by an older CLI).
187
183
-`edit_resource.py TYPE ID < script.py`: fetch resource by ID, execute Python on it (resource in `r`), then update it. TYPE is `jobs` or `pipelines`.
188
184
-`gron.py`: flatten JSON into greppable discrete assignments (simpler than `jq` for searching JSON).
0 commit comments