-
Notifications
You must be signed in to change notification settings - Fork 237
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
[SNC-392] compile support for policy test command #973
[SNC-392] compile support for policy test command #973
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a high level it lgtm!
@@ -490,6 +494,44 @@ This group of commands allows the management of polices to be verified against b | |||
runnerOpts := tester.RunnerOptions{ | |||
Path: args[0], | |||
Include: include, | |||
Compile: func(data []byte, pipelineValues map[string]any) ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels like a good candidate for a separate function outside of command definition
@@ -1330,13 +1331,31 @@ func TestTestRunner(t *testing.T) { | |||
assert.Contains(t, s, "<?xml") | |||
}, | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test suggestion:
compile: true
, but owner-id isn't provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the current test case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is if compilation is required, but owner-id isn't provided, it should fail in some way.
But the expectation is pass in this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Owner-ID is only required if you need to pull a private orb
Checklist
=========
Internal Checklist
Changes
=======
circleci policy test
command by adding the policy-agent compile functionRationale
=========
To provide a better testing experience of CircleCI Config Policies, we needed to update the policy-agent that understood the compile and pipeline_parameters directive, and provide a compilation function for it to use.