-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(docs): Add examples as unit tests #4255
Comments
Partially addresses: #4255 Signed-off-by: Simar <simar@linux.com>
There are Rego policies for testing here. We can replace them with examples or use them in the unit tests additionally. |
This issue is stale because it has been labeled with inactivity. |
@simar7 Is it still relevant? How will we keep the examples in the documentation up to date? How about adding tests for good/bad examples for each check in the trivy-checks repository? |
Yes that's why we want to implement them as unit tests so we don't have to continually keep the documentation up to date.
You can see the example I shared here https://github.com/aquasecurity/trivy/tree/b43b19ba54cbf30adfaf98febccef033701a1df3/examples/misconf/custom-policy and https://github.com/aquasecurity/trivy/tree/2f318ce97d6bd058894e35a413c001e647681ae1/pkg/fanal/artifact/local/testdata/misconfig we could reuse these assuming most of them are still relevant as they pertain to current checks. |
Some of the examples that used to exist as part of markdown documents were either outdated or not maintained actively. One such example is here: https://aquasecurity.github.io/trivy/v0.41/docs/scanner/misconfiguration/custom/examples/
@knqyf263 suggested that we can make them into unit tests as such: https://github.com/aquasecurity/trivy/blob/55fb723a6e00cc36d89a548ab0c7b31544aa6044/integration/module_test.go
The text was updated successfully, but these errors were encountered: