Skip to content

fix(test): restore compilation of analytics integration tests - #1139

Merged
cristim merged 1 commit into
mainfrom
fix/analytics-itest-compile
Jun 10, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/analytics-itest-compile

Conversation

@cristim

@cristim cristim commented Jun 10, 2026

Copy link
Copy Markdown
Member

What

Restores compilation of the internal/analytics integration tests so the Lint job (and the rest of CI) passes again. After #1137 merged, golangci-lint v2 type-checks //go:build integration files; this exposed that these tests were written against a removed QueryRequest.AccountID API and the old single-string account signatures of QueryByProvider / QueryByService / QueryMonthlyTotals, so they had not compiled since the account-filter model changed. Main's Lint is currently red, which blocks every open PR from going green.

Changes

  • Dedup getMigrationsPath (keep the db_test.go copy; both files are package analytics_test) and drop its now-unused runtime / path/filepath imports.
  • Add an f64ptr helper and wrap the *float64 fields TotalUsage and CoveragePercentage.
  • Remap the removed QueryRequest.AccountID and the string-account args of QueryByProvider / QueryByService / QueryMonthlyTotals to the current AccountUUIDs / AccountExternalIDsByProvider model.

Scope / verification

  • go vet -tags=integration ./internal/analytics/ -> clean
  • go build ./... -> clean
  • gofmt -> clean

These tests run only under Docker/testcontainers (CI Lint just type-checks them). This PR restores compilation only - the runtime correctness of the remapped account filters is intentionally not verified here (the account-filter area has a documented history of silent breakage) and is tracked in LeanerCloud/cloud-commitments-platform#32.

Refs #1137, LeanerCloud/cloud-commitments-platform#32

golangci-lint v2 (#1137) now type-checks //go:build integration files, which
exposed that internal/analytics' integration tests were written against a
removed QueryRequest.AccountID API and the old single-string account
signatures of QueryByProvider/QueryByService/QueryMonthlyTotals, so they had
not compiled since the account-filter model changed. CI Lint on main is red
as a result. Restore compilation:

- dedup getMigrationsPath (keep the db_test.go copy; both files are
  package analytics_test) and drop its now-unused runtime/path/filepath imports
- add an f64ptr helper and wrap the *float64 fields TotalUsage and
  CoveragePercentage
- remap the removed QueryRequest.AccountID and the string-account args of
  QueryByProvider/QueryByService/QueryMonthlyTotals to the current
  AccountUUIDs/AccountExternalIDsByProvider model

These tests run only under Docker/testcontainers; CI Lint just type-checks
them. Runtime correctness of the remapped account filters is NOT verified
here and is tracked in #1138.

Refs #1138
@cristim

cristim commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@cristim
cristim merged commit e7bede5 into main Jun 10, 2026
10 of 15 checks passed
@cristim
cristim deleted the fix/analytics-itest-compile branch July 27, 2026 11:10
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.

1 participant