Exemple #1
0
def test_setup_reporter_from_parameter(set_librato_credentials):
    rep = metric.setup_reporter('librato')
    assert isinstance(rep, reporter.LibratoReport)

    rep = metric.setup_reporter('direct')
    assert isinstance(rep, reporter.DirectReport)

    rep = metric.setup_reporter('dummy')
    assert isinstance(rep, reporter.DummyReport)
Exemple #2
0
def test_set_source_from_env_setting_when_passing_none():
    os.environ[
        'METRICS_SOURCE'] = 'environ_source2'  # probably should cleanup, but...
    rep = metric.setup_reporter('librato', None)
    assert rep.source == 'environ_source2'
Exemple #3
0
def test_set_source_from_parameter(set_librato_credentials):
    rep = metric.setup_reporter('librato', 'custom_source')
    assert rep.source == 'custom_source'
Exemple #4
0
def test_setup_non_existent_reporter():
    with pytest.raises(reporter.StatsReportException):
        rep = metric.setup_reporter('no-such-reporter')
Exemple #5
0
def test_setup_reporter_defaults(set_librato_credentials):
    # Librato is our default without config for the moment
    assert isinstance(metric.setup_reporter(), reporter.LibratoReport)
Exemple #6
0
def test_direct_gauge_submission():
    rep = metric.setup_reporter('direct')
    rep.gauge("Test.SubmissionDirectCheck", 1)
Exemple #7
0
def test_librato_gauge(set_librato_credentials):
    rep = metric.setup_reporter('librato')
    rep.gauge("Test.SubmissionLibratoCheck", 1)