Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Unified Diff: infra_libs/ts_mon/test/config_test.py

Issue 2119933003: Add Configurable metric_name_prefix (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add trailing slash Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra_libs/ts_mon/config.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra_libs/ts_mon/test/config_test.py
diff --git a/infra_libs/ts_mon/test/config_test.py b/infra_libs/ts_mon/test/config_test.py
index 6b5d203a300168f2280978d12539516f611c89ea..9bef02f515e0d5ad29a2bfa8c92a312cdad6f82b 100644
--- a/infra_libs/ts_mon/test/config_test.py
+++ b/infra_libs/ts_mon/test/config_test.py
@@ -304,6 +304,13 @@ class GlobalsTest(auto_stub.TestCase):
with self.assertRaises(SystemExit):
config.process_argparse_options(args)
+ def test_metric_name_prefix(self):
+ p = argparse.ArgumentParser()
+ config.add_argparse_options(p)
+ args = p.parse_args(['--ts-mon-metric-name-prefix', '/test/random/'])
+ config.process_argparse_options(args)
+ self.assertEqual('/test/random/', interface.state.metric_name_prefix)
+
@mock.patch('infra_libs.ts_mon.common.monitors.NullMonitor', autospec=True)
def test_no_args(self, fake_monitor):
singleton = mock.Mock()
@@ -313,6 +320,7 @@ class GlobalsTest(auto_stub.TestCase):
args = p.parse_args([])
config.process_argparse_options(args)
self.assertEqual(1, len(fake_monitor.mock_calls))
+ self.assertEqual('/chrome/infra/', interface.state.metric_name_prefix)
self.assertIs(interface.state.global_monitor, singleton)
@mock.patch('requests.get', autospec=True)
« no previous file with comments | « infra_libs/ts_mon/config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698