Test harnesses in cuelang using golden files #2902
mogsie
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We want to be able to validate our cue files, so that when we make changes, then we know that previously implemented cue functionality hasn't been broken.
To do this, we have started to employ golden files:
test.cue
The test package can then exercise the package under test in different ways, and ensure that its behaviour is unchanged. This can be captured in a simple Makefile.
make test
to verify andmake golden
to update any golden files when changes are desired.We sometimes skip adding constraints for other imported types (like k8s or other go commands) to speed up normal execution, and then you can add additional constraints to the test output, e.g.
Here is an excerpt of the Makefile:
Beta Was this translation helpful? Give feedback.
All reactions