swift/test/unit/account
Matthew Oliver 00bfc425ce Add FakeStatsdClient to unit tests
Currently we simply mock calls in the FakeLogger for calls statsd calls,
and there are also some helper methods for counting and collating
metrics that were called. This Fakelogger is overloaded and doesn't
simulate the real world.
In real life we use a Statsdclient that is attached to the logger.

We've been in the situation where unit tests pass but the statsd client
stacktraces because we don't actually fake the statsdclient based off
the real one and let it's use its internal logic.

This patch creates a new FakeStatsdClient that is based off the real
one, this can then be used (like the real statsd client) and attached to
the FakeLogger.
There is quite a bit of churn in tests to make this work, because we now
have to looking into the fake statsd client to check the faked calls
made.
The FakeStatsdClient does everything the real one does, except overrides
the _send method and socket creation so no actual statsd metrics are
emitted.

Change-Id: I9cdf395e85ab559c2b67b0617f898ad2d6a870d4
2023-08-07 10:10:45 +01:00
..
__init__.py Initial commit of Swift code 2010-07-12 17:03:45 -05:00
test_auditor.py Add FakeStatsdClient to unit tests 2023-08-07 10:10:45 +01:00
test_backend.py CI: test under py311 2023-06-22 17:28:12 -07:00
test_reaper.py Add FakeStatsdClient to unit tests 2023-08-07 10:10:45 +01:00
test_replicator.py Make db_replicator usync smaller containers 2015-10-19 15:26:12 +01:00
test_server.py Add FakeStatsdClient to unit tests 2023-08-07 10:10:45 +01:00
test_utils.py Remove :memory: from DatabaseBrokers and unittests 2022-07-12 12:30:43 +10:00