Java: add integration test for query suite contents#19229
Merged
tamasvajk merged 2 commits intogithub:mainfrom Apr 8, 2025
Merged
Java: add integration test for query suite contents#19229tamasvajk merged 2 commits intogithub:mainfrom
tamasvajk merged 2 commits intogithub:mainfrom
Conversation
5bd0c39 to
d17d441
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an integration test to verify the query suite contents for Java.
- Adds a new integration test file that iterates over defined query suites and compares expected query files with actual output.
Files not reviewed (4)
- java/ql/integration-tests/java/query-suite/java-code-quality.qls.expected: Language not supported
- java/ql/integration-tests/java/query-suite/java-code-scanning.qls.expected: Language not supported
- java/ql/integration-tests/java/query-suite/java-security-and-quality.qls.expected: Language not supported
- java/ql/integration-tests/java/query-suite/java-security-extended.qls.expected: Language not supported
Comments suppressed due to low confidence (1)
java/ql/integration-tests/java/query-suite/test.py:11
- Consider validating that each line in the actual query output is at least as long as the semmle_code_dir prefix to avoid slicing errors.
index = len(str(semmle_code_dir))
Tip: Leave feedback on Copilot's review comments with the 👎 and 👍 buttons to help improve review quality. Learn more
redsun82
reviewed
Apr 7, 2025
|
|
||
| for query_suite in query_suites: | ||
| actual = codeql.resolve.queries(query_suite, _capture=True).strip() | ||
| actual = sorted(actual.split('\n')) |
Contributor
There was a problem hiding this comment.
here is not required as we're running this on Linux, but just so you know, actual.splitlines() will work across platforms (accounting for Windows \n\r line separation)
Co-authored-by: Paolo Tranquilli <redsun82@github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0f5c53b to
ffcf6d6
Compare
owen-mc
approved these changes
Apr 8, 2025
| import pytest | ||
|
|
||
| @runs_on.linux | ||
| @pytest.mark.parametrize("query_suite", ['java-code-quality.qls', 'java-security-and-quality.qls', 'java-security-extended.qls', 'java-code-scanning.qls']) |
Contributor
There was a problem hiding this comment.
Nitpick: consider making these in alphabetical order.
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.
This PR adds an integration test that explicitly checks which Java queries are included in which query suite.