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

Side by Side Diff: infra/services/gsubtreed/test/gsubtreed_test.py

Issue 1325753006: Fix a flaky gsubtreed test caused by git2.repo logging (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 collections 5 import collections
6 import json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 import sys 9 import sys
10 import tempfile 10 import tempfile
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 success, processed = gsubtreed.inner_loop(local, cref) 95 success, processed = gsubtreed.inner_loop(local, cref)
96 except Exception: # pragma: no cover 96 except Exception: # pragma: no cover
97 ret.append(traceback.format_exc().splitlines()) 97 ret.append(traceback.format_exc().splitlines())
98 finally: 98 finally:
99 gsubtreed.Pusher.FAKE_THREADING = False 99 gsubtreed.Pusher.FAKE_THREADING = False
100 100
101 sys.stdout = stdout 101 sys.stdout = stdout
102 sys.stderr = stderr 102 sys.stderr = stderr
103 103
104 root_logger.removeHandler(shandler) 104 root_logger.removeHandler(shandler)
105 ret.append({'log output': logout.getvalue().splitlines()}) 105
106 # infra.libs.git2.repo logs this message if the command took longer than
107 # 1s to run. This causes test flakes occasionally.
108 log_lines = [x for x in logout.getvalue().splitlines()
109 if 'Finished in ' not in x]
110 ret.append({'log output': log_lines})
106 111
107 ret.append({ 112 ret.append({
108 'inner_loop success': success, 113 'inner_loop success': success,
109 'processed': processed, 114 'processed': processed,
110 }) 115 })
111 116
112 gsubtreed_test_definitions.GSUBTREED_TESTS[test_name]( 117 gsubtreed_test_definitions.GSUBTREED_TESTS[test_name](
113 origin=origin, run=run, checkpoint=checkpoint, mirrors=mirrors, 118 origin=origin, run=run, checkpoint=checkpoint, mirrors=mirrors,
114 config=cref, local_origin_repo=local) 119 config=cref, local_origin_repo=local)
115 120
116 return expect_tests.Result(ret) 121 return expect_tests.Result(ret)
117 122
118 123
119 @expect_tests.test_generator 124 @expect_tests.test_generator
120 def GenTests(): 125 def GenTests():
121 for test_name, test in gsubtreed_test_definitions.GSUBTREED_TESTS.iteritems(): 126 for test_name, test in gsubtreed_test_definitions.GSUBTREED_TESTS.iteritems():
122 yield expect_tests.Test( 127 yield expect_tests.Test(
123 __package__ + '.' + test_name, 128 __package__ + '.' + test_name,
124 expect_tests.FuncCall(RunTest, test_name), 129 expect_tests.FuncCall(RunTest, test_name),
125 expect_base=test_name, ext='yaml', break_funcs=[test], 130 expect_base=test_name, ext='yaml', break_funcs=[test],
126 covers=( 131 covers=(
127 expect_tests.Test.covers_obj(RunTest) + 132 expect_tests.Test.covers_obj(RunTest) +
128 expect_tests.Test.covers_obj(gsubtreed_test_definitions) 133 expect_tests.Test.covers_obj(gsubtreed_test_definitions)
129 )) 134 ))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698