Esempio n. 1
0
    def test_get_dependency_tcp(self, lazy_client_cls, stats_config):
        statsd = StatsD('test-tcp')
        statsd.container = Mock()
        statsd.container.config = stats_config
        statsd.setup()

        worker_ctx = Mock()

        dep = statsd.get_dependency(worker_ctx)

        assert lazy_client_cls.call_args_list == [
            call(host='tcp.statsd.host',
                 port=4321,
                 prefix='tcp.statsd.prefix',
                 timeout=5,
                 enabled=True,
                 protocol='tcp')
        ]
        assert dep == lazy_client_cls.return_value
Esempio n. 2
0
    def test_get_dependency(self, lazy_client_cls, stats_config):
        statsd = StatsD('test')
        statsd.container = Mock()
        statsd.container.config = stats_config
        statsd.setup()

        worker_ctx = Mock()

        dep = statsd.get_dependency(worker_ctx)

        assert lazy_client_cls.call_args_list == [
            call(
                host='statsd.host',
                port=1234,
                prefix='statsd.prefix',
                maxudpsize=1024,
                enabled=True,
            )
        ]
        assert dep == lazy_client_cls.return_value