Files
swift/test/unit/obj/test_reconstructor.py
Clay Gerrard 563c1ca656 DRY out AbstractStatsdClient public methods
Both the StatsdClient and LabeledStatsdClient implemented all of the
public interface methods for an AbstractStatsdClient.  Even though the
implementations are identical the interfaces themselves were made
different WRT the "last" positional arg if provided.

This change puts the identical implementations of the public interface
in the AbstractStatsdClient class with a generic interface.  For
backwards compat with the existing public interface on the
legacy-StatsdClient we have to make the old signature explicit - but we
can transparently call into the common implementation.

For consistency with legacy-Statsdclient and better docstrings this
change also "fixes" the signature for the new LabeledStatsdClient public
interface methods so they explicitly state labels must always be passed
in as a kwarg to avoid confusion accidentally passing in
`sample_rate=<dict>` or `label=<float>` as a positional arg.

Drive-by: as a side-effect of consolidating the implementations there
was now only one place to extend a fix in the FakeStatedClient interface
so that tests who assert StatsdClient method calls don't have to read
like the UUT also called some *other* public StatsdClient method; which
also cleaned up some Fake helpers that deal specifically with counters.

Drive-by: fix stub return value TypeError in a _get_hashes mock that was
caught by better faking. N.B. it doesn't matter how statsd would have
handled 'metric:None|c' because it was only a test bug.

Change-Id: I4d8a4b530465b587caced4362eb9178507701cef
2025-04-08 17:03:43 -05:00

299 KiB