Skip to content

Commit 4faf744

Browse files
committed
WIP: Update golden test framework
* Move to envtest by default (instead of mock-kubeapiserver) * Use a more convention env var * Support object rewriting
1 parent 11d31d2 commit 4faf744

File tree

2 files changed

+280
-178
lines changed

2 files changed

+280
-178
lines changed

docs/addon/walkthrough/tests.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This means that the output is materialized and checked in to the repo; this
3333
proves to be very handy for understanding the impact of a change.
3434

3535
There's also a helpful "cheat" function, which rewrite the output when you run
36-
the tests locally - set the HACK_AUTOFIX_EXPECTED_OUTPUT env var to a non-empty
36+
the tests locally - set the WRITE_GOLDEN_OUTPUT env var to a non-empty
3737
string. This is useful when you have a big set of changes; it's just as easy to
3838
review the changes yourself in the diff and there's not a ton of value in typing
3939
them out.
@@ -87,7 +87,7 @@ the env-var cheat code.
8787
```bash
8888
cd pkg/controller/{{operator}}/tests
8989
touch tests/simple.out.yaml
90-
HACK_AUTOFIX_EXPECTED_OUTPUT=1 go test ./...
90+
WRITE_GOLDEN_OUTPUT=1 go test ./...
9191
```
9292

9393
1. Verify the output is reproducible

0 commit comments

Comments
 (0)