Add --file-name-override flag to override group name for stdin input#1163
Open
NoNickeD wants to merge 3 commits intoopen-policy-agent:masterfrom
Open
Add --file-name-override flag to override group name for stdin input#1163NoNickeD wants to merge 3 commits intoopen-policy-agent:masterfrom
NoNickeD wants to merge 3 commits intoopen-policy-agent:masterfrom
Conversation
a39db24 to
9f2b39f
Compare
NoNickeD
added a commit
to NoNickeD/conftest
that referenced
this pull request
Sep 19, 2025
- Renamed flag from 'group' to 'file-name-override' for clarity - Rewrote tests to use TestRunner.Run() method with proper test fixtures - Added comprehensive acceptance tests for the new flag - Fixed Rego v1 syntax in test policies - Added proper error handling and edge case testing Addresses review feedback from PR open-policy-agent#1163 Signed-off-by: nikos.nikolakakis <nonickedgr@gmail.com>
jalseth
reviewed
Oct 23, 2025
Member
jalseth
left a comment
There was a problem hiding this comment.
LGTM! Just a couple of minor changes. Thanks for the PR and sorry for the slow review cycle.
| defer func() { os.Stdin = oldStdin }() | ||
|
|
||
| // Run the test | ||
| ctx := context.Background() |
| } | ||
| }` | ||
| go func() { | ||
| defer w.Close() |
Member
There was a problem hiding this comment.
nit: This defer isn't needed, you can w.Close() after the line below.
| Failures: []output.Result{{Message: "test failure"}}, | ||
| }, | ||
| // Run with a regular file (not stdin) | ||
| ctx := context.Background() |
Member
|
@NoNickeD friendly ping. |
Member
|
@NoNickeD It looks like the tests are failing. You may need to rebase against the latest changes. |
20992cc to
4f66540
Compare
NoNickeD
added a commit
to NoNickeD/conftest
that referenced
this pull request
Dec 11, 2025
- Renamed flag from 'group' to 'file-name-override' for clarity - Rewrote tests to use TestRunner.Run() method with proper test fixtures - Added comprehensive acceptance tests for the new flag - Fixed Rego v1 syntax in test policies - Added proper error handling and edge case testing Addresses review feedback from PR open-policy-agent#1163 Signed-off-by: nikos.nikolakakis <nonickedgr@gmail.com>
Member
|
@NoNickeD can you rebase again? There were some changes to the required PR checks, and I don't think there's another way to trigger them to run. |
- Add --group CLI flag to test command for custom group naming - Override FileName from '-' to custom group name when --group is provided - Enables better identification of policy violations in CI/CD workflows - Add unit tests for group flag functionality Fixes open-policy-agent#1095 Signed-off-by: nikos.nikolakakis <nonickedgr@gmail.com>
- Renamed flag from 'group' to 'file-name-override' for clarity - Rewrote tests to use TestRunner.Run() method with proper test fixtures - Added comprehensive acceptance tests for the new flag - Fixed Rego v1 syntax in test policies - Added proper error handling and edge case testing Addresses review feedback from PR open-policy-agent#1163 Signed-off-by: nikos.nikolakakis <nonickedgr@gmail.com>
- Use t.Context() instead of context.Background() - Remove unnecessary defer in goroutine, call w.Close() directly Signed-off-by: nikos.nikolakakis <nonickedgr@gmail.com>
4f66540 to
485d063
Compare
Author
|
Done! Rebased on top of the latest master. |
Member
|
@NoNickeD The tests are not passing. Please ensure the tests pass locally and then I will check again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1095
This PR adds a --group flag to the conftest test command that allows overriding the group name for stdin input.
Problem: When using conftest with kustomize in loops, output shows generic 'FAIL - - main - message' making it hard to identify which component failed.
Solution: Add --group flag to specify custom group name for better traceability.
Usage:
Output:
FAIL - - main - messageFAIL - my/component - main - messageChanges:
Enables better CI/CD traceability and GitHub annotations.