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

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

Issue 2114073002: Add HttpsMonitor (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix coverage 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 9bef02f515e0d5ad29a2bfa8c92a312cdad6f82b..c736acd262715edc5e98f8abd4039ae158e62079 100644
--- a/infra_libs/ts_mon/test/config_test.py
+++ b/infra_libs/ts_mon/test/config_test.py
@@ -65,6 +65,32 @@ class GlobalsTest(auto_stub.TestCase):
@mock.patch('requests.get', autospec=True)
@mock.patch('socket.getfqdn', autospec=True)
+ @mock.patch('infra_libs.ts_mon.common.monitors.HttpsMonitor.'
+ '_load_credentials', autospec=True)
+ def test_https_monitor_args(self, _load_creds, fake_fqdn, fake_get):
+ print [_load_creds, fake_fqdn, fake_get]
+ fake_fqdn.return_value = 'slave1-a1.reg.tld'
+ fake_get.return_value.side_effect = requests.exceptions.ConnectionError
+ p = argparse.ArgumentParser()
+ config.add_argparse_options(p)
+ args = p.parse_args([
+ '--ts-mon-credentials', '/path/to/creds.p8.json',
+ '--ts-mon-endpoint', 'https://test/random:insert'])
+
+ config.process_argparse_options(args)
+
+ self.assertIsInstance(interface.state.global_monitor,
+ monitors.HttpsMonitor)
+
+ self.assertIsInstance(interface.state.target, targets.DeviceTarget)
+ self.assertEquals(interface.state.target.hostname, 'slave1-a1')
+ self.assertEquals(interface.state.target.region, 'reg')
+ self.assertEquals(args.ts_mon_flush, 'auto')
+ self.assertIsNotNone(interface.state.flush_thread)
+ self.assertTrue(standard_metrics.up.get())
+
+ @mock.patch('requests.get', autospec=True)
+ @mock.patch('socket.getfqdn', autospec=True)
def test_default_target_uppercase_fqdn(self, fake_fqdn, fake_get):
fake_fqdn.return_value = 'SLAVE1-A1.REG.TLD'
fake_get.return_value.side_effect = requests.exceptions.ConnectionError
« 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