open-policy-agent / conftest

Write tests against structured configuration data using the Open Policy Agent Rego query language
https://conftest.dev
Other
2.88k stars 307 forks source link

fix: Conftest can now successfully load files using a file URL (e.g., `file:///C:/path/to/data.yaml`) on windows #999

Open pckvcode opened 2 months ago

pckvcode commented 2 months ago

Conftest encounters errors on Windows when loading file paths that include drive letters (e.g., C:/path/to/data.yaml). Even when using a file URL (e.g., file:///C:/path/to/data.yaml), we still face issues.

Screenshot 2024-08-30 at 10 31 39 AM

With these code changes, Conftest can now successfully load files using a file URL (e.g., file:///C:/path/to/data.yaml).

Screenshot 2024-09-03 at 5 10 00 PM

We opted for file URLs(e.g., file:///C:/path/to/data.yaml) instead of paths with drive letters (e.g., C:/path/to/data.yaml) because OPA does not support file paths with drive letters. For more details, see this issue comment.

Resolves: https://github.com/open-policy-agent/conftest/issues/979

@boranx Can you please review this changes? Thank you

jalseth commented 1 month ago

@pckvcode It looks like the code tests are passing but the style check is not. Please squash your commits and ensure that the commit is prefixed with fix: to follow conventional commits formatting.