chore(tests): pin team-usage subtests to seed month window#392
Merged
nijeesh-stream merged 1 commit intoMay 13, 2026
Merged
Conversation
dd1ddb5 to
cf86800
Compare
QueryTeamUsageStats defaults the no-parameter overload to the current
month (monthly mode) per backend
controllers/chat/v1/query_team_usage_stats.go:147-150. The
multi-tenant test app's seeded fixtures live in 2026-02
(assertAllMetricsExact reads 2026-02-18 / 2026-02-19), so the default
window only overlaps the seed when CI runs during that month.
Otherwise: empty result, require.Greater fires, the whole job goes red.
Skipping on empty masks a permanent seed gap (skip path triggers
forever once we leave Feb), so pin every assertion-bearing subtest to
the seed month via a single `seedMonth = "2026-02"` constant. Also
covers the two previously silent loop-over-empty subtests that the
prior skip-only patch missed ("Pagination returns different teams",
"Metric totals non-negative"). When the seed pipeline rotates, this
is the one constant to update.
Real fix is a per-PR seeded test app — tracked separately.
cf86800 to
1dc7ece
Compare
mogita
approved these changes
May 13, 2026
slavabobik
approved these changes
May 13, 2026
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.
Summary
TestQueryTeamUsageStats_IntegrationandTestQueryTeamUsageStats_DataCorrectnessmix two kinds of subtests:Date-filtered queries (
StartDate=2026-02-01,Month=2026-02, etc.) — these target the seeded fixture window on the multi-tenant test app and always pass.No-parameter queries (
QueryTeamUsageStats(ctx, nil)) — the backend defaults this to the current month (monthly mode), percontrollers/chat/v1/query_team_usage_stats.go:145-150:The OpenAPI spec confirms: "If neither provided, defaults to current month (monthly mode)".
The multi-tenant test app's seeded fixtures live in 2026-02 (
assertAllMetricsExactreads fromStartDate 2026-02-18 / EndDate 2026-02-19), so the no-param window only overlaps the seed when CI runs during that month. Outside that month → empty teams →require.Greaterfires → whole job goes red.Fix
Pin every assertion-bearing subtest to the seed-month window via a single
const seedMonth = "2026-02". When the seed pipeline rotates, this is the one constant to update. Patches all 9 affected subtests (7 covered by the earlier skip-only attempt + the 2 it missed: "Pagination returns different teams" and "Metric totals non-negative" — both used limit-only /niland silently passed when teams was empty).Skip-on-empty was wrong: it would trigger forever (the seed pipeline doesn't refresh to the current month), so CI would be permanently "green on broken infra".
Real fix
Per-PR seeded test app — tracked separately. Backend seed pipeline also doesn't populate the current month, which is a real infra gap.
Test plan
go vet ./...cleango test -c -o /dev/null .compiles cleanTestQueryTeamUsageStats_*across the Go matrix