Skip to content

Commit

Permalink
Add test to cover empty prefix branch
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Jan 16, 2025
1 parent 7858496 commit 78d8241
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/plugins/test_prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,19 @@ def test_count_with_legacy_string_basic_group(self):

resp = self.app.get("/__metrics__")
self.assertIn('kintoprod_mushrooms_total{species="boletus"} 1.0', resp.text)


@skip_if_no_prometheus
class PrometheusNoPrefixTest(PrometheusWebTest):
@classmethod
def get_app_settings(cls, extras=None):
settings = super().get_app_settings(extras)
settings["project_name"] = "Some Project"
settings["prometheus_prefix"] = ""
return settings

def test_metrics_have_no_prefix(self):
self.app.app.registry.metrics.observe("price", 111)

resp = self.app.get("/__metrics__")
self.assertIn("TYPE price summary", resp.text)

0 comments on commit 78d8241

Please sign in to comment.