mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
feat(azure_policy): test runner, compiler fixes, and example program (#700)
Adds the YAML test runner that exercises the companion test data PRs, plus several compiler fixes surfaced during testing: - Removed parameter register caching that produced wrong results inside short-circuiting allOf/anyOf blocks; added literal-index caching for parameter defaults to avoid repeated O(n) literal-table scans - Simplified cross-resource effect details to only emit roleDefinitionIds and type (deployment templates are not evaluated for compliance) - Replaced guid/uniqueString builtins with clear "unsupported" errors - Normalized datetime output to ISO 8601 with Z suffix - Added azure_policy parser MAX_COL constant (8192) for long template expressions, keeping the global DEFAULT_MAX_COL at 1024 - Added rvm to azure_policy feature dependencies since the compiler targets RVM bytecode Also restructures the example binary into examples/regorus/ with new azure-policy-eval and azure-policy-aliases subcommands, adds C# alias normalization tests, and documents Azure Policy support in the README. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7f42115b63
commit
4c92fb4d92
@@ -339,7 +339,7 @@ fn custom_max_col_allows_wide_line() -> Result<()> {
|
||||
use regorus::{Engine, PolicyLengthConfig};
|
||||
|
||||
// A line wider than the default 1024 columns.
|
||||
let wide = format!("package test\na := \"{}\"", "x".repeat(2000));
|
||||
let wide = format!("package test\na := \"{}\"", "x".repeat(9000));
|
||||
|
||||
let mut engine = Engine::new();
|
||||
|
||||
@@ -351,7 +351,7 @@ fn custom_max_col_allows_wide_line() -> Result<()> {
|
||||
|
||||
// Should succeed with a raised max_col.
|
||||
engine.set_policy_length_config(PolicyLengthConfig {
|
||||
max_col: NonZeroU32::new(4096).unwrap(),
|
||||
max_col: NonZeroU32::new(16384).unwrap(),
|
||||
..Default::default()
|
||||
});
|
||||
engine.add_policy("wide.rego".into(), wide)?;
|
||||
|
||||
Reference in New Issue
Block a user