Skip to content
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

Testing Regula advanced rules? #277

Open
christophetd opened this issue Dec 31, 2020 · 1 comment
Open

Testing Regula advanced rules? #277

christophetd opened this issue Dec 31, 2020 · 1 comment

Comments

@christophetd
Copy link

Hello,

Is it possible to use fregot test to run unit tests of Regula advanced rules making use of fugue.resources, fugue.deny_resource and similar functions?

So far, simply running fregot test raises errors because it's not aware of the definition of these functions:

$ frego test rules/aws_s3_bucket_public_access_block.rego
 "rules/aws_s3_bucket_public_access_block.rego" (line 12, column 11):
  unknown call:

    12| buckets = fugue.resources("AWS.S3.Bucket")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  Unknown call to fugue.resources

...

Thanks!

@jaspervdj-luminal
Copy link
Member

Right -- fregot needs to be aware of the definitions to run them. You can pass multiple files and/or directories to fregot test, so you can try something like: fregot test lib rules tests examples (or anything more fine-tuned as well). But since Regula tests require a little bit of set up, I would start by copying some existing tests in the Regula repository and then go from there.

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

No branches or pull requests

2 participants