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

Side by Side Diff: client/common_lib/barrier_unittest.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 __author__ = """Ashwin Ganti (aganti@google.com)""" 3 __author__ = """Ashwin Ganti (aganti@google.com)"""
4 4
5 import os, sys, socket, errno, unittest, threading 5 import os, sys, socket, errno, unittest, threading
6 from time import time, sleep 6 from time import time, sleep
7 import common 7 import common
8 from autotest_lib.client.common_lib import error, base_barrier 8 from autotest_lib.client.common_lib import error, base_barrier
9 barrier = base_barrier 9 barrier = base_barrier
10 from autotest_lib.client.common_lib.test_utils import mock 10 from autotest_lib.client.common_lib.test_utils import mock
(...skipping 29 matching lines...) Expand all
40 40
41 def test_initialize(self): 41 def test_initialize(self):
42 b = barrier.barrier('127.0.0.1#', 'testtag', 100, 11921) 42 b = barrier.barrier('127.0.0.1#', 'testtag', 100, 11921)
43 self.assertEqual(b._hostid, '127.0.0.1#') 43 self.assertEqual(b._hostid, '127.0.0.1#')
44 self.assertEqual(b._tag, 'testtag') 44 self.assertEqual(b._tag, 'testtag')
45 self.assertEqual(b._timeout_secs, 100) 45 self.assertEqual(b._timeout_secs, 100)
46 self.assertEqual(b._port, 11921) 46 self.assertEqual(b._port, 11921)
47 47
48 48
49 def test_get_host_from_id(self): 49 def test_get_host_from_id(self):
50 b = barrier.barrier('127.0.0.1#', 'testgethost', 100) 50 hostname = barrier.get_host_from_id('my_host')
51
52 hostname = b._get_host_from_id('my_host')
53 self.assertEqual(hostname, 'my_host') 51 self.assertEqual(hostname, 'my_host')
54 52
55 hostname = b._get_host_from_id('my_host#') 53 hostname = barrier.get_host_from_id('my_host#')
56 self.assertEqual(hostname, 'my_host') 54 self.assertEqual(hostname, 'my_host')
57 55
58 self.assertRaises(error.BarrierError, b._get_host_from_id, '#my_host') 56 self.assertRaises(error.BarrierError, barrier.get_host_from_id, '#my_hos t')
59 57
60 58
61 def test_update_timeout(self): 59 def test_update_timeout(self):
62 b = barrier.barrier('127.0.0.1#', 'update', 100) 60 b = barrier.barrier('127.0.0.1#', 'update', 100)
63 b._update_timeout(120) 61 b._update_timeout(120)
64 self.assertEqual(b._timeout_secs, 120) 62 self.assertEqual(b._timeout_secs, 120)
65 63
66 64
67 def test_remaining(self): 65 def test_remaining(self):
68 b = barrier.barrier('127.0.0.1#', 'remain', 100) 66 b = barrier.barrier('127.0.0.1#', 'remain', 100)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 Test that reusing the same listen server object works. 192 Test that reusing the same listen server object works.
195 """ 193 """
196 server = barrier.listen_server() 194 server = barrier.listen_server()
197 self.rendezvous_test(10, listen_server=server) 195 self.rendezvous_test(10, listen_server=server)
198 self.rendezvous_test(10, listen_server=server) 196 self.rendezvous_test(10, listen_server=server)
199 self.rendezvous_test(10, listen_server=server) 197 self.rendezvous_test(10, listen_server=server)
200 198
201 199
202 if __name__ == "__main__": 200 if __name__ == "__main__":
203 unittest.main() 201 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698