OPS-157454: Group live OData tests as integration and exclude them from CI - #56
Conversation
…om CI
Eight test classes (ODataClientIntegrationTests and the seven classes under IntegrationTests/) call
the public services.odata.org sample services over the network, and nothing grouped them, so both
the build job and the coverage job ran them on every push. They now carry
[Trait("Category", "Integration")] and both CI test steps pass
--filter-not-trait "Category=Integration". Offline tests still run in full (762 locally).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Not up to standards ⛔🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
🔴 Coverage ∅ diff coverage · -1.52% coverage variation
Metric Results Coverage variation ❌ -1.52% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (f12337c) 3023 2543 84.12% Head commit (97d3b87) 3023 (+0) 2497 (-46) 82.60% (-1.52%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#56) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
The Codacy analysis indicates this PR is not up to standards, primarily due to a significant drop in test coverage. While the objective of excluding external integration tests from CI is sound, the implementation contains critical syntax errors in the GitHub Actions workflow. Specifically, the use of '--filter-not-trait' is invalid for 'dotnet test' and the testing platform.
Additionally, excluding these tests has resulted in a 100% coverage loss for 'ODataClient.ServiceDocument.cs'. This core parsing logic is now unverified in CI. It is recommended to implement unit tests using a mocked 'HttpClient' to restore coverage for this component without reintroducing external network dependencies. These issues should be resolved before merging to maintain build integrity and code quality.
About this PR
- The exclusion of integration tests has revealed a lack of underlying unit test coverage for core components, specifically in 'ODataClient.ServiceDocument.cs'. While the move to isolate network-dependent tests is correct, core logic parsing must still be validated via unit tests to prevent future regressions.
Test suggestions
- Verify 'dotnet test' command in CI uses the filter flag
- Verify the coverage runner command in CI uses the filter flag
- Confirm all eight mentioned test classes are decorated with the trait
- Unit tests for ODataClient.ServiceDocument.cs logic using mocked HttpClient to restore coverage
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Unit tests for ODataClient.ServiceDocument.cs logic using mocked HttpClient to restore coverage
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| --coverage-settings PanoramicData.OData.Client.Test/coverage.config | ||
| --coverage-output-format cobertura | ||
| --coverage-output coverage.cobertura.xml | ||
| --filter-not-trait "Category=Integration" |
There was a problem hiding this comment.
🔴 HIGH RISK
The '--filter-not-trait' flag is not supported by the testing platform. Use the '--filter' option with a conditional expression to exclude the integration category.
| --filter-not-trait "Category=Integration" | |
| --filter "Category!=Integration" |
| # Integration tests call the public services.odata.org sample services and are run locally, never in CI. | ||
| - name: Test | ||
| run: dotnet test --configuration Release --no-build --verbosity normal | ||
| run: dotnet test --configuration Release --no-build --verbosity normal --filter-not-trait "Category=Integration" |
There was a problem hiding this comment.
🔴 HIGH RISK
The '--filter-not-trait' argument is invalid and will cause the filter to be ignored or the command to fail. Use the standard '--filter' option instead:
| run: dotnet test --configuration Release --no-build --verbosity normal --filter-not-trait "Category=Integration" | |
| run: dotnet test --configuration Release --no-build --verbosity normal --filter "Category!=Integration" |
Additionally, excluding these tests has dropped the coverage of 'ODataClient.ServiceDocument.cs' from 87.5% to 0%. Consider implementing unit tests using a mocked HttpClient or HttpMessageHandler to test ServiceDocument parsing with static XML payloads, ensuring this logic is validated in CI without requiring live OData services.
Eight test classes (ODataClientIntegrationTests and the seven classes under IntegrationTests/) call
the public services.odata.org sample services over the network, and nothing grouped them, so both
the build job and the coverage job ran them on every push. They now carry
[Trait("Category", "Integration")] and both CI test steps pass
--filter-not-trait "Category=Integration". Offline tests still run in full (762 locally).
Tracked under OPS-157454 (integration tests must not run in CI).
🤖 Generated with Claude Code