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

Unified Diff: infra/services/sysmon/test/system_metrics_test.py

Issue 2109393002: Make test_net_info a bit more robust. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add tests Created 4 years, 6 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/services/sysmon/system_metrics.py ('k') | infra_libs/ts_mon/common/metric_store.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/services/sysmon/test/system_metrics_test.py
diff --git a/infra/services/sysmon/test/system_metrics_test.py b/infra/services/sysmon/test/system_metrics_test.py
index 65ae0127bfd579eedf0950e4ec7daca0b01b0b57..ccce512b5d1e9b488f15947116c3d63671385699 100644
--- a/infra/services/sysmon/test/system_metrics_test.py
+++ b/infra/services/sysmon/test/system_metrics_test.py
@@ -111,19 +111,27 @@ class SystemMetricsTest(unittest.TestCase):
self.assertIsNotNone(total)
self.assertLessEqual(free, total)
- # See http://crbug.com/624369
- def DISABLED_test_net_info(self): # pragma: no cover
+ def test_net_info(self):
system_metrics.get_net_info()
+ interface_names = [fields[0][1]
+ for fields, _
+ in system_metrics.net_up.get_all()]
+ self.assertGreater(len(interface_names), 0)
+
# A network interface that should always be present.
if sys.platform == 'win32': # pragma: no cover
- interface = 'Local Area Connection'
+ self.assertTrue(
+ any(x.startswith('Local Area Connection') for x in interface_names),
+ interface_names)
elif sys.platform == 'darwin': # pragma: no cover
- interface = 'en0'
+ self.assertTrue(
+ any(x.startswith('en') for x in interface_names),
+ interface_names)
else: # pragma: no cover
- interface = 'lo'
+ self.assertIn('lo', interface_names)
- labels = {'interface': interface}
+ labels = {'interface': interface_names[0]}
self.assertIsNotNone(system_metrics.net_up.get(labels))
self.assertIsNotNone(system_metrics.net_down.get(labels))
« no previous file with comments | « infra/services/sysmon/system_metrics.py ('k') | infra_libs/ts_mon/common/metric_store.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698