Skip to content

fix(test): clear default containercollector stub before custom return#205

Merged
Dhanrajkshirsagar merged 3 commits into
mainfrom
fix/container-metrics-test
Jun 1, 2026
Merged

fix(test): clear default containercollector stub before custom return#205
Dhanrajkshirsagar merged 3 commits into
mainfrom
fix/container-metrics-test

Conversation

@Dhanrajkshirsagar

Copy link
Copy Markdown
Contributor

setupTestMetricsPusher registers a nil-returning stub for containercollector. Collect. Testify uses the first registered expectation, so any custom Return added by an individual test was silently ignored — the container metrics never appeared in the payload.

Clear ExpectedCalls before registering the test-specific return so the custom data reaches PushMetrics as expected.

Dhanraj and others added 3 commits June 1, 2026 23:23
setupTestMetricsPusher registers a nil-returning stub for containercollector.
Collect. Testify uses the first registered expectation, so any custom
Return added by an individual test was silently ignored — the container
metrics never appeared in the payload.

Clear ExpectedCalls before registering the test-specific return so the
custom data reaches PushMetrics as expected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR #203 was merged before the mock fix landed, so main is missing
CollectRouters on MockTraefikCollector and the default CollectRouters
stub in setupTestMetricsPusher. Adds both so the test suite compiles
and passes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Dhanrajkshirsagar Dhanrajkshirsagar merged commit debeb46 into main Jun 1, 2026
1 check passed
@Dhanrajkshirsagar Dhanrajkshirsagar deleted the fix/container-metrics-test branch June 1, 2026 18:05
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