OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The LUCI Authors. All rights reserved. | 2 # Copyright 2015 The LUCI Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
5 | 5 |
6 import collections | 6 import collections |
7 import contextlib | 7 import contextlib |
8 import datetime | 8 import datetime |
9 import json | 9 import json |
10 import os | 10 import os |
11 import shutil | 11 import shutil |
12 import tempfile | 12 import tempfile |
13 import threading | 13 import threading |
14 import time | 14 import time |
15 import unittest | 15 import unittest |
16 import StringIO | 16 import StringIO |
17 | 17 |
18 import test_env | 18 import test_env |
19 | 19 |
20 import libs.logdog.stream | 20 import libs.logdog.stream |
21 import libs.logdog.varint | 21 import libs.logdog.varint |
22 from google.protobuf import json_format as jsonpb | 22 from google.protobuf import json_format as jsonpb |
23 from recipe_engine import recipe_api | 23 from recipe_engine import recipe_api |
24 from recipe_engine import stream | |
25 from recipe_engine import stream_logdog | 24 from recipe_engine import stream_logdog |
26 | 25 |
27 | 26 |
28 import annotations_pb2 as pb | 27 import annotations_pb2 as pb |
29 | 28 |
30 | 29 |
31 @contextlib.contextmanager | 30 @contextlib.contextmanager |
32 def tempdir(): | 31 def tempdir(): |
33 tdir = tempfile.mkdtemp(suffix='stream_logdog_test', dir=test_env.BASE_DIR) | 32 tdir = tempfile.mkdtemp(suffix='stream_logdog_test', dir=test_env.BASE_DIR) |
34 try: | 33 try: |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 sn = sn.append('#!!! stream name !!!') | 1021 sn = sn.append('#!!! stream name !!!') |
1023 self.assertEqual(str(sn), 'base/s______stream_name____') | 1022 self.assertEqual(str(sn), 'base/s______stream_name____') |
1024 | 1023 |
1025 def testAugmentInvalidStreamNameNormalizes(self): | 1024 def testAugmentInvalidStreamNameNormalizes(self): |
1026 sn = stream_logdog._StreamName('base') | 1025 sn = stream_logdog._StreamName('base') |
1027 self.assertEqual(str(sn.augment(' !!! other !!! ')), 'base_____other_____') | 1026 self.assertEqual(str(sn.augment(' !!! other !!! ')), 'base_____other_____') |
1028 | 1027 |
1029 | 1028 |
1030 if __name__ == '__main__': | 1029 if __name__ == '__main__': |
1031 unittest.main() | 1030 unittest.main() |
OLD | NEW |