Repository navigation
Commit 04abef0
test: [#849] adversarial test expansion for validator utilities
Expands the validator test suite from 39 to 117 tests, covering
boundary conditions, malformed inputs, and realistic dbt output patterns
that the original suite did not exercise.
**extractLastJsonObject adversarial cases**
- Stray JSON rejection: empty object, array with no envelope keys,
objects with only unknown keys, numeric keys
- Envelope key guard: null/false/empty-string values still accepted when
key is present; `error: null` does not invalidate the envelope
- Noisy stdout scanning: Python traceback + JSON, 50-line progress
noise, BOM prefix, CRLF line endings, > 10 KB leading noise,
whitespace-padded JSON
- Last-wins semantics: two valid envelopes (last wins), three valid
envelopes (last wins), stray fragments between valid envelopes,
same-line consecutive objects
- Brace/string parsing: nested braces in string values, escaped
backslashes, escaped double-quotes, multiline string values, stdout
field containing inner JSON, unicode characters, unicode escape
sequences, multi-line formatted JSON, unbalanced `{` in log noise
**parseDbtTestOutput adversarial cases**
- Null/empty guard: null, undefined, whitespace-only, truncated output,
dbt compile error (no Done. line)
- All-pass: clean run, SKIP-only, WARN-only
- NO-OP variant: zero tests, multiple NO-OP counts
- Failure extraction: deduplication of repeated test names, FAIL vs
ERROR lines, `[FAIL`/`[ERROR` token exclusion, test names with dots,
15+ failing tests captured
- Large counts: 99999 pass, 99999 error, zero counts, single test
- Format resilience: case-insensitive Done., named groups vs positional
(PASS=7 ERROR=3 TOTAL=11), timestamps, ANSI colours, CRLF line
endings, summary at very start/end of string, multiple summary lines
- Realistic full-output scenarios: dbt 1.8 all-pass, dbt 1.8 partial
failures, ANSI-coloured Docker output, no-tests-defined NO-OP,
SKIP from --exclude flag
**findDbtProjectRoot adversarial cases**
- Two-level deep search limit: project at depth 2 is NOT found
- dbt_project.yml is a directory (documents stat behavior)
- Many subdirs, only one has the file
- Direct takes precedence over nested
**modelsModifiedSince adversarial cases**
- Depth boundary: depth 4 included, depth 5 excluded (with path counts)
- Non-.sql files inside models/: yml, md, py, json all excluded
- File named `models.sql` outside a `models/` path component excluded
- Mtime boundary: file with mtime === sinceMs is included (>= semantics)
- Mixed modified/unmodified files
- Empty models/ directory (no SQL files)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>1 parent 0724de3 commit 04abef0
2 files changed
Lines changed: 794 additions & 176 deletions
0 commit comments