Skip to content

fix: mock public DogStatsd API instead of private _report method#130

Open
notque wants to merge 1 commit intomasterfrom
fix/statsd-mock-public-api
Open

fix: mock public DogStatsd API instead of private _report method#130
notque wants to merge 1 commit intomasterfrom
fix/statsd-mock-public-api

Conversation

@notque
Copy link
Copy Markdown
Contributor

@notque notque commented Mar 23, 2026

Summary

  • Replaces mocking of private DogStatsd._report() with public increment() and gauge() methods
  • Bumps datadog from 0.51.0 to 0.52.1 in test-requirements.txt
  • Fixes 57/74 test failures caused by _report() signature change in datadog 0.52.x

Context

PR #121 (Renovate: datadog 0.51.0 → 0.52.1) fails because the internal _report() method
gained new kwargs (sampling, cardinality) in 0.52.x. Rather than patching the assertions
to match the new internal signature, this PR mocks the public API so tests are resilient to
future internal refactors.

Test plan

  • All 74 unit tests pass (stestr)
  • flake8 clean
  • bandit clean
  • CI passes on this branch

Notes

  • The value parameter in assert_statsd_counter() is no longer asserted because the
    production code uses increment()'s default value. This is documented in the docstring.
  • Once this merges, PR chore(deps): update dependency datadog to v0.52.1 #121 can be closed as superseded.

The datadog 0.52.x release added new parameters to the internal
_report() method, breaking all 57 tests that mocked it. Switch to
mocking the public increment() and gauge() methods so tests are
resilient to future internal refactors.
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