Skip to content

feat: support all-in-one request.yaml, enforce gold files, improve README#5

Merged
zemanlx merged 2 commits into
mainfrom
feat/request-yaml-consolidation
Apr 24, 2026
Merged

feat: support all-in-one request.yaml, enforce gold files, improve README#5
zemanlx merged 2 commits into
mainfrom
feat/request-yaml-consolidation

Conversation

@zemanlx

@zemanlx zemanlx commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Summary

Support consolidating all test fixtures into a single .request.yaml file, add conflict detection when fields are defined in multiple files, enforce .gold.yaml for mutating tests, and improve README for first-time users.

Changes

All-in-one .request.yaml

  • object, oldObject, params, namespaceObject, userInfo, and other fields can now all be defined in a single .request.yaml file
  • Alternatively, they can still be split across separate files (.object.yaml, .params.yaml, etc.)
  • Golden file (.gold.yaml) lookup works from .request.yaml files for mutating tests

Conflict detection during merge

  • mergeTestRequests now returns an error if a field (object, oldObject, params, namespaceObject) is already set when merging from another file
  • Removes the old conflictCheck struct and checkConflicts function — conflicts are detected generically at merge time
  • Removed redundant auxiliary file loading (loadParamsFile, loadAuthorizerFile) from parseObjectYAML/parseOldObjectYAML — the suite loop already handles these registered file types

.namespaceObject.yaml support

  • Added as a new registered file type in isTestFile and testBaseName
  • Added parseNamespaceObjectYAML parser with v1/Namespace validation

Enforce .gold.yaml for mutating tests

  • If a MutatingAdmissionPolicy produces a mutation but no .gold.yaml is provided, the test fails with: "policy mutated the object but no .gold.yaml file was provided"
  • Renamed stale .expected.yaml to .gold.yaml in namespace-selector-binding-mutating tests (was silently ignored before)

README rewrite

  • Added Quick Start section with a minimal end-to-end example
  • Documented all-in-one vs split file approaches
  • Fixed the file type list (added namespaceObject, authorizer, annotations, warnings)
  • Fleshed out all four expected outcomes (allow, deny, warn, audit)
  • Moved Features to the bottom — usage-first ordering

Test fixtures added

  • test-policies-pass: all-in-one .request.yaml tests for validating and mutating
  • test-policies-fail: object conflict detection, missing .gold.yaml

@zemanlx zemanlx force-pushed the feat/request-yaml-consolidation branch from 22ea8c9 to 973f4c4 Compare April 24, 2026 15:02
@zemanlx zemanlx merged commit 777c9ce into main Apr 24, 2026
2 checks passed
@zemanlx zemanlx deleted the feat/request-yaml-consolidation branch April 24, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant