Skip to content

feat(test): add support for folder-based query test cases#7647

Merged
cx-romeu-silva merged 6 commits into
masterfrom
AST-101229
Aug 18, 2025
Merged

feat(test): add support for folder-based query test cases#7647
cx-romeu-silva merged 6 commits into
masterfrom
AST-101229

Conversation

@cx-romeu-silva

@cx-romeu-silva cx-romeu-silva commented Aug 13, 2025

Copy link
Copy Markdown
Contributor

Reason for Proposed Changes

  • The current Query File Tree structure looks like:
    - <technology>/
      |- <provider>/
      |  |- <queryfolder>/
      |  |  |- test/
      |  |  |  |- positive[1..]<.ext>
      |  |  |  |- negative[1..]<.ext>
      |  |  |  |- positive_expected_result.json
      |  |  |- metadata.json
      |  |  |- query.rego
    
  • Limitation: Some queries access multiple resources, which can be located in different files but the current structure forces all related resources into the same file

Proposed Changes

  • Update the KICS test framework to support organizing test cases in folders, enabling better structuring of complex test scenarios.
  • The new Query File Tree structure extends on the existing one and looks like:
    - <technology>/
      |- <provider>/
      |  |- <queryfolder>/
      |  |  |- test/
      |  |  |  |- positive[1..]<.ext>
      |  |  |  |- negative[1..]<.ext>
      |  |  |  |- positive_expected_result.json
      |  |  |  |- positive[1..]/ (= <folder_name>/)
      |  |  |  |  |- <folder_name>_[1..]<.ext>
      |  |  |  |  |- positive_expected_result.json
      |  |  |  |- negative[1..]/ (= <folder_name>/)
      |  |  |  |  |- <folder_name>_[1..]<.ext>
      |  |  |- metadata.json
      |  |  |- query.rego
    
  • Update documentation to reflect new folder-based test case organization.

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions Bot added community Community contribution query New query feature labels Aug 13, 2025
@github-actions

Copy link
Copy Markdown
Contributor

kics-logo

KICS version: v2.1.11

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@cx-romeu-silva cx-romeu-silva changed the title add support for folder-based query test cases feat(test) - add support for folder-based query test cases Aug 13, 2025
@github-actions github-actions Bot added the feature request Community: new feature request label Aug 13, 2025
@cx-romeu-silva cx-romeu-silva self-assigned this Aug 13, 2025
@cx-romeu-silva cx-romeu-silva changed the title feat(test) - add support for folder-based query test cases feat(test): add support for folder-based query test cases Aug 13, 2025
@cx-romeu-silva cx-romeu-silva marked this pull request as ready for review August 14, 2025 11:19
@cx-romeu-silva cx-romeu-silva requested a review from a team as a code owner August 14, 2025 11:19

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice work Romeu, insane improvement to KICS, specially for Terraform related test cases.

@cx-romeu-silva cx-romeu-silva merged commit 65f76f8 into master Aug 18, 2025
25 checks passed
@cx-romeu-silva cx-romeu-silva deleted the AST-101229 branch August 18, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Community contribution feature request Community: new feature request query New query feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants