diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2019-09-10 00:14:58 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-10 00:14:58 +1000 |
commit | aeb9b2179eaa4b468bec937570d3ac7de7ccaaea (patch) | |
tree | f61e06d2116a4d8d5c1cf85719460e293dcdbc94 /tests | |
parent | Merge pull request #6003 from matrix-org/erikj/push_opentracing (diff) | |
download | synapse-aeb9b2179eaa4b468bec937570d3ac7de7ccaaea.tar.xz |
Add a build info metric to Prometheus (#6005)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_metrics.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 2edbae5c6d..270f853d60 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Copyright 2018 New Vector Ltd +# Copyright 2019 Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,8 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - -from synapse.metrics import InFlightGauge +from synapse.metrics import REGISTRY, InFlightGauge, generate_latest from tests import unittest @@ -111,3 +111,21 @@ class TestMauLimit(unittest.TestCase): } return results + + +class BuildInfoTests(unittest.TestCase): + def test_get_build(self): + """ + The synapse_build_info metric reports the OS version, Python version, + and Synapse version. + """ + items = list( + filter( + lambda x: b"synapse_build_info{" in x, + generate_latest(REGISTRY).split(b"\n"), + ) + ) + self.assertEqual(len(items), 1) + self.assertTrue(b"osversion=" in items[0]) + self.assertTrue(b"pythonversion=" in items[0]) + self.assertTrue(b"version=" in items[0]) |