Skip to content

test(cost_report): add wiremock integration coverage for the exported handler#88

Merged
joshrotenberg merged 1 commit into
mainfrom
test/cost-report-coverage
May 15, 2026
Merged

test(cost_report): add wiremock integration coverage for the exported handler#88
joshrotenberg merged 1 commit into
mainfrom
test/cost-report-coverage

Conversation

@joshrotenberg
Copy link
Copy Markdown
Contributor

Summary

CostReportHandler is publicly exported and on the OpenAPI spec, but previously had only crate-internal unit tests covering the request builder. A type-shape regression on /cost-report (POST) or its download endpoint would slip past CI.

Adds tests/cost_report_tests.rs with 9 tests covering happy + error paths for both endpoints.

Coverage matrix added

Method 2xx happy 4xx 5xx Body shape
generate_cost_report 400, 401 500 full filter set asserted via body_json
generate_cost_report_raw extra fields preserved
download_cost_report 404 503 byte stream round-trip

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace — all pass; 9 new tests green

No source changes.

Closes #79

… handler

`CostReportHandler` is publicly exported and on the OpenAPI spec, but
previously had only crate-internal unit tests for the request builder
shape. A type-shape regression on `/cost-report` or its download
endpoint would slip past CI.

Adds `tests/cost_report_tests.rs` covering:

- `generate_cost_report` happy path with body-assertion
- `generate_cost_report` with the full filter surface (formats,
  subscription_ids, database_ids, subscription_type, regions, tag)
- `generate_cost_report_raw` returning JSON Value (extra fields
  preserved)
- `generate_cost_report` 400 / 401 / 500 error paths
- `download_cost_report` happy path returning the byte stream
- `download_cost_report` 404 and 503 error paths

Total: 9 new tests, all green.

Closes #79
@joshrotenberg joshrotenberg merged commit 48fcc64 into main May 15, 2026
8 checks passed
@joshrotenberg joshrotenberg deleted the test/cost-report-coverage branch May 15, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cost_report): handler has zero tests; add full mock coverage

1 participant