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

How can I make the tests include a shared library rego file? #21

Open
eedgar opened this issue Dec 9, 2024 · 3 comments
Open

How can I make the tests include a shared library rego file? #21

eedgar opened this issue Dec 9, 2024 · 3 comments
Assignees

Comments

@eedgar
Copy link

eedgar commented Dec 9, 2024

I have a set of tests that utilize a common shared library rego file

eg
/policy/utils.rego
/policy/test/foo_test.rego
/policy/test/foo.rego. (this includes the contents of utils via an import)

the tests are failing because it cant find the utils package.

if I run opa test . ../utils.rego from the test dir I can make the test work locally.

@oycyc oycyc self-assigned this Dec 9, 2024
@oycyc
Copy link
Collaborator

oycyc commented Dec 9, 2024

Ah this case with importing isn't covered by this GitHub Actions. I could certainly put in an hour or two sometime this week to implement this or if you'd like to contribute too.

Just for a little more information, the GitHub Actions is failing on foo.rego because it's importing utils.rego or is the test itself failing?

if I run opa test . ../utils.rego from the test dir I can make the test work locally.

Is there tests for utils.rego in foo_test.rego or does foo.rego tests foo_test.rego failing only because the import failing?

@oycyc
Copy link
Collaborator

oycyc commented Dec 9, 2024

I believe this is failing because this GitHub Actions tests it by running foo.rego against foo_test.rego

@Gowiem
Copy link
Member

Gowiem commented Jan 15, 2025

@eedgar quick follow up to make sure that we're closing the loop on this issue: Did @oycyc's questions / clarification of what is going on with your setup fix your issue? Or do you believe something needs to be done here?

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

3 participants