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

Side by Side Diff: infra_libs/ts_mon/common/test/targets_test.py

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: add noncululativedistribution metric to ts_mon imports Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « infra_libs/ts_mon/common/test/standard_metrics_test.py ('k') | infra_libs/ts_mon/config.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import unittest 5 import unittest
6 6
7 from monacq.proto import metrics_pb2 7 try:
8 8 from monacq.proto import metrics_pb2
9 from infra_libs.ts_mon import targets 9 from infra_libs.ts_mon.common import targets
10 except ImportError: # pragma: no cover
11 from monacq.proto import metrics_pb2
12 from common import targets
10 13
11 14
12 class DeviceTargetTest(unittest.TestCase): 15 class DeviceTargetTest(unittest.TestCase):
13 16
14 def test_populate_target(self): 17 def test_populate_target(self):
15 pb = metrics_pb2.MetricsData() 18 pb = metrics_pb2.MetricsData()
16 t = targets.DeviceTarget('reg', 'net', 'host') 19 t = targets.DeviceTarget('reg', 'net', 'host')
17 t._populate_target_pb(pb) 20 t._populate_target_pb(pb)
18 self.assertEquals(pb.network_device.metro, 'reg') 21 self.assertEquals(pb.network_device.metro, 'reg')
19 self.assertEquals(pb.network_device.hostgroup, 'net') 22 self.assertEquals(pb.network_device.hostgroup, 'net')
20 self.assertEquals(pb.network_device.hostname, 'host') 23 self.assertEquals(pb.network_device.hostname, 'host')
21 self.assertEquals(pb.network_device.realm, 'ACQ_CHROME') 24 self.assertEquals(pb.network_device.realm, 'ACQ_CHROME')
22 self.assertEquals(pb.network_device.alertable, True) 25 self.assertEquals(pb.network_device.alertable, True)
23 26
24 27
25 class TaskTargetTest(unittest.TestCase): 28 class TaskTargetTest(unittest.TestCase):
26 29
27 def test_populate_target(self): 30 def test_populate_target(self):
28 pb = metrics_pb2.MetricsData() 31 pb = metrics_pb2.MetricsData()
29 t = targets.TaskTarget('serv', 'job', 'reg', 'host') 32 t = targets.TaskTarget('serv', 'job', 'reg', 'host')
30 t._populate_target_pb(pb) 33 t._populate_target_pb(pb)
31 self.assertEquals(pb.task.service_name, 'serv') 34 self.assertEquals(pb.task.service_name, 'serv')
32 self.assertEquals(pb.task.job_name, 'job') 35 self.assertEquals(pb.task.job_name, 'job')
33 self.assertEquals(pb.task.data_center, 'reg') 36 self.assertEquals(pb.task.data_center, 'reg')
34 self.assertEquals(pb.task.host_name, 'host') 37 self.assertEquals(pb.task.host_name, 'host')
35 self.assertEquals(pb.task.task_num, 0) 38 self.assertEquals(pb.task.task_num, 0)
OLDNEW
« no previous file with comments | « infra_libs/ts_mon/common/test/standard_metrics_test.py ('k') | infra_libs/ts_mon/config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698