blob: e8abf795ac0031f08aaeb9247417087aec6bbaea [file] [log] [blame]
Gregory Haynes4fc12542015-04-22 20:38:06 -07001# Copyright 2015 GoodData
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import logging
Jan Hrubane252a732017-01-03 15:03:09 +010016import re
17from testtools.matchers import MatchesRegex
Jan Hruban324ca5b2015-11-05 19:28:54 +010018import time
Gregory Haynes4fc12542015-04-22 20:38:06 -070019
Wayne1a78c612015-06-11 17:14:13 -070020from tests.base import ZuulTestCase, simple_layout, random_sha1
Gregory Haynes4fc12542015-04-22 20:38:06 -070021
22logging.basicConfig(level=logging.DEBUG,
23 format='%(asctime)s %(name)-32s '
24 '%(levelname)-8s %(message)s')
25
26
27class TestGithubDriver(ZuulTestCase):
28 config_file = 'zuul-github-driver.conf'
29
30 @simple_layout('layouts/basic-github.yaml', driver='github')
31 def test_pull_event(self):
32 self.executor_server.hold_jobs_in_build = True
33
Jan Hruban37615e52015-11-19 14:30:49 +010034 A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
35 self.fake_github.emitEvent(A.getPullRequestOpenedEvent())
Gregory Haynes4fc12542015-04-22 20:38:06 -070036 self.waitUntilSettled()
37
38 build_params = self.builds[0].parameters
39 self.assertEqual('master', build_params['ZUUL_BRANCH'])
Jan Hruban37615e52015-11-19 14:30:49 +010040 self.assertEqual(str(A.number), build_params['ZUUL_CHANGE'])
41 self.assertEqual(A.head_sha, build_params['ZUUL_PATCHSET'])
Gregory Haynes4fc12542015-04-22 20:38:06 -070042
43 self.executor_server.hold_jobs_in_build = False
44 self.executor_server.release()
45 self.waitUntilSettled()
46
47 self.assertEqual('SUCCESS',
48 self.getJobFromHistory('project-test1').result)
49 self.assertEqual('SUCCESS',
50 self.getJobFromHistory('project-test2').result)
51
52 job = self.getJobFromHistory('project-test2')
53 zuulvars = job.parameters['vars']['zuul']
Jan Hruban37615e52015-11-19 14:30:49 +010054 self.assertEqual(A.number, zuulvars['change'])
55 self.assertEqual(A.head_sha, zuulvars['patchset'])
56 self.assertEqual(1, len(A.comments))
Jan Hruband4edee82015-12-16 12:49:51 +010057 self.assertEqual(2, len(self.history))
58
59 # test_pull_unmatched_branch_event(self):
60 self.create_branch('org/project', 'unmatched_branch')
61 B = self.fake_github.openFakePullRequest(
62 'org/project', 'unmatched_branch', 'B')
63 self.fake_github.emitEvent(B.getPullRequestOpenedEvent())
64 self.waitUntilSettled()
65
66 self.assertEqual(2, len(self.history))
Wayne1a78c612015-06-11 17:14:13 -070067
Jan Hruban570d01c2016-03-10 21:51:32 +010068 @simple_layout('layouts/files-github.yaml', driver='github')
69 def test_pull_matched_file_event(self):
70 A = self.fake_github.openFakePullRequest(
71 'org/project', 'master', 'A',
72 files=['random.txt', 'build-requires'])
73 self.fake_github.emitEvent(A.getPullRequestOpenedEvent())
74 self.waitUntilSettled()
75 self.assertEqual(1, len(self.history))
76
77 # test_pull_unmatched_file_event
78 B = self.fake_github.openFakePullRequest('org/project', 'master', 'B',
79 files=['random.txt'])
80 self.fake_github.emitEvent(B.getPullRequestOpenedEvent())
81 self.waitUntilSettled()
82 self.assertEqual(1, len(self.history))
83
Jan Hrubanc7ab1602015-10-14 15:29:33 +020084 @simple_layout('layouts/basic-github.yaml', driver='github')
85 def test_comment_event(self):
Jan Hruban37615e52015-11-19 14:30:49 +010086 A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
87 self.fake_github.emitEvent(A.getCommentAddedEvent('test me'))
Jan Hrubanc7ab1602015-10-14 15:29:33 +020088 self.waitUntilSettled()
89 self.assertEqual(2, len(self.history))
90
91 # Test an unmatched comment, history should remain the same
Jan Hruban37615e52015-11-19 14:30:49 +010092 B = self.fake_github.openFakePullRequest('org/project', 'master', 'B')
93 self.fake_github.emitEvent(B.getCommentAddedEvent('casual comment'))
Jan Hrubanc7ab1602015-10-14 15:29:33 +020094 self.waitUntilSettled()
95 self.assertEqual(2, len(self.history))
96
Wayne1a78c612015-06-11 17:14:13 -070097 @simple_layout('layouts/push-tag-github.yaml', driver='github')
98 def test_tag_event(self):
99 self.executor_server.hold_jobs_in_build = True
100
101 sha = random_sha1()
102 self.fake_github.emitEvent(
103 self.fake_github.getPushEvent('org/project', 'refs/tags/newtag',
104 new_rev=sha))
105 self.waitUntilSettled()
106
107 build_params = self.builds[0].parameters
108 self.assertEqual('refs/tags/newtag', build_params['ZUUL_REF'])
109 self.assertEqual('00000000000000000000000000000000',
110 build_params['ZUUL_OLDREV'])
111 self.assertEqual(sha, build_params['ZUUL_NEWREV'])
112
113 self.executor_server.hold_jobs_in_build = False
114 self.executor_server.release()
115 self.waitUntilSettled()
116
117 self.assertEqual('SUCCESS',
118 self.getJobFromHistory('project-tag').result)
119
120 @simple_layout('layouts/push-tag-github.yaml', driver='github')
121 def test_push_event(self):
122 self.executor_server.hold_jobs_in_build = True
123
124 old_sha = random_sha1()
125 new_sha = random_sha1()
126 self.fake_github.emitEvent(
127 self.fake_github.getPushEvent('org/project', 'refs/heads/master',
128 old_sha, new_sha))
129 self.waitUntilSettled()
130
131 build_params = self.builds[0].parameters
132 self.assertEqual('refs/heads/master', build_params['ZUUL_REF'])
133 self.assertEqual(old_sha, build_params['ZUUL_OLDREV'])
134 self.assertEqual(new_sha, build_params['ZUUL_NEWREV'])
135
136 self.executor_server.hold_jobs_in_build = False
137 self.executor_server.release()
138 self.waitUntilSettled()
139
140 self.assertEqual('SUCCESS',
141 self.getJobFromHistory('project-post').result)
Jan Hruband4edee82015-12-16 12:49:51 +0100142 self.assertEqual(1, len(self.history))
143
144 # test unmatched push event
145 old_sha = random_sha1()
146 new_sha = random_sha1()
147 self.fake_github.emitEvent(
148 self.fake_github.getPushEvent('org/project',
149 'refs/heads/unmatched_branch',
150 old_sha, new_sha))
151 self.waitUntilSettled()
152
153 self.assertEqual(1, len(self.history))
Jan Hruban6d53c5e2015-10-24 03:03:34 +0200154
Jan Hruban16ad31f2015-11-07 14:39:07 +0100155 @simple_layout('layouts/labeling-github.yaml', driver='github')
156 def test_labels(self):
Jan Hruban37615e52015-11-19 14:30:49 +0100157 A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
Jan Hruban16ad31f2015-11-07 14:39:07 +0100158 self.fake_github.emitEvent(A.addLabel('test'))
159 self.waitUntilSettled()
160 self.assertEqual(1, len(self.history))
161 self.assertEqual('project-labels', self.history[0].name)
162 self.assertEqual(['tests passed'], A.labels)
163
164 # test label removed
Jan Hruban37615e52015-11-19 14:30:49 +0100165 B = self.fake_github.openFakePullRequest('org/project', 'master', 'B')
Jan Hruban16ad31f2015-11-07 14:39:07 +0100166 B.addLabel('do not test')
167 self.fake_github.emitEvent(B.removeLabel('do not test'))
168 self.waitUntilSettled()
169 self.assertEqual(2, len(self.history))
170 self.assertEqual('project-labels', self.history[1].name)
171 self.assertEqual(['tests passed'], B.labels)
172
173 # test unmatched label
Jan Hruban37615e52015-11-19 14:30:49 +0100174 C = self.fake_github.openFakePullRequest('org/project', 'master', 'C')
Jan Hruban16ad31f2015-11-07 14:39:07 +0100175 self.fake_github.emitEvent(C.addLabel('other label'))
176 self.waitUntilSettled()
177 self.assertEqual(2, len(self.history))
178 self.assertEqual(['other label'], C.labels)
179
Jan Hruban324ca5b2015-11-05 19:28:54 +0100180 @simple_layout('layouts/dequeue-github.yaml', driver='github')
181 def test_dequeue_pull_synchronized(self):
182 self.executor_server.hold_jobs_in_build = True
183
Jan Hruban37615e52015-11-19 14:30:49 +0100184 A = self.fake_github.openFakePullRequest(
185 'org/one-job-project', 'master', 'A')
186 self.fake_github.emitEvent(A.getPullRequestOpenedEvent())
Jan Hruban324ca5b2015-11-05 19:28:54 +0100187 self.waitUntilSettled()
188
189 # event update stamp has resolution one second, wait so the latter
190 # one has newer timestamp
191 time.sleep(1)
Jan Hruban37615e52015-11-19 14:30:49 +0100192 A.addCommit()
193 self.fake_github.emitEvent(A.getPullRequestSynchronizeEvent())
Jan Hruban324ca5b2015-11-05 19:28:54 +0100194 self.waitUntilSettled()
195
196 self.executor_server.hold_jobs_in_build = False
197 self.executor_server.release()
198 self.waitUntilSettled()
199
200 self.assertEqual(2, len(self.history))
201 self.assertEqual(1, self.countJobResults(self.history, 'ABORTED'))
202
203 @simple_layout('layouts/dequeue-github.yaml', driver='github')
204 def test_dequeue_pull_abandoned(self):
205 self.executor_server.hold_jobs_in_build = True
206
Jan Hruban37615e52015-11-19 14:30:49 +0100207 A = self.fake_github.openFakePullRequest(
208 'org/one-job-project', 'master', 'A')
209 self.fake_github.emitEvent(A.getPullRequestOpenedEvent())
Jan Hruban324ca5b2015-11-05 19:28:54 +0100210 self.waitUntilSettled()
Jan Hruban37615e52015-11-19 14:30:49 +0100211 self.fake_github.emitEvent(A.getPullRequestClosedEvent())
Jan Hruban324ca5b2015-11-05 19:28:54 +0100212 self.waitUntilSettled()
213
214 self.executor_server.hold_jobs_in_build = False
215 self.executor_server.release()
216 self.waitUntilSettled()
217
218 self.assertEqual(1, len(self.history))
219 self.assertEqual(1, self.countJobResults(self.history, 'ABORTED'))
220
Jan Hruban6d53c5e2015-10-24 03:03:34 +0200221 @simple_layout('layouts/basic-github.yaml', driver='github')
222 def test_git_https_url(self):
223 """Test that git_ssh option gives git url with ssh"""
224 url = self.fake_github.real_getGitUrl('org/project')
225 self.assertEqual('https://github.com/org/project', url)
226
227 @simple_layout('layouts/basic-github.yaml', driver='github')
228 def test_git_ssh_url(self):
229 """Test that git_ssh option gives git url with ssh"""
230 url = self.fake_github_ssh.real_getGitUrl('org/project')
231 self.assertEqual('ssh://git@github.com/org/project.git', url)
Jan Hrubane252a732017-01-03 15:03:09 +0100232
233 @simple_layout('layouts/reporting-github.yaml', driver='github')
234 def test_reporting(self):
235 # pipeline reports pull status both on start and success
236 self.executor_server.hold_jobs_in_build = True
Jan Hruban37615e52015-11-19 14:30:49 +0100237 A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
238 self.fake_github.emitEvent(A.getPullRequestOpenedEvent())
Jan Hrubane252a732017-01-03 15:03:09 +0100239 self.waitUntilSettled()
Jan Hruban37615e52015-11-19 14:30:49 +0100240 self.assertIn('check', A.statuses)
241 check_status = A.statuses['check']
Jan Hrubanddeb95a2017-01-03 15:12:41 +0100242 check_url = ('http://zuul.example.com/status/#%s,%s' %
243 (A.number, A.head_sha))
Jan Hrubane252a732017-01-03 15:03:09 +0100244 self.assertEqual('Standard check', check_status['description'])
245 self.assertEqual('pending', check_status['state'])
Jan Hrubanddeb95a2017-01-03 15:12:41 +0100246 self.assertEqual(check_url, check_status['url'])
Jan Hruban37615e52015-11-19 14:30:49 +0100247 self.assertEqual(0, len(A.comments))
Jan Hrubane252a732017-01-03 15:03:09 +0100248
249 self.executor_server.hold_jobs_in_build = False
250 self.executor_server.release()
251 self.waitUntilSettled()
Jan Hruban37615e52015-11-19 14:30:49 +0100252 check_status = A.statuses['check']
Jan Hrubane252a732017-01-03 15:03:09 +0100253 self.assertEqual('Standard check', check_status['description'])
254 self.assertEqual('success', check_status['state'])
Jan Hrubanddeb95a2017-01-03 15:12:41 +0100255 self.assertEqual(check_url, check_status['url'])
Jan Hruban37615e52015-11-19 14:30:49 +0100256 self.assertEqual(1, len(A.comments))
257 self.assertThat(A.comments[0],
Jan Hrubane252a732017-01-03 15:03:09 +0100258 MatchesRegex('.*Build succeeded.*', re.DOTALL))
259
260 # pipeline does not report any status but does comment
261 self.executor_server.hold_jobs_in_build = True
262 self.fake_github.emitEvent(
Jan Hruban37615e52015-11-19 14:30:49 +0100263 A.getCommentAddedEvent('reporting check'))
Jan Hrubane252a732017-01-03 15:03:09 +0100264 self.waitUntilSettled()
Jan Hruban37615e52015-11-19 14:30:49 +0100265 self.assertNotIn('reporting', A.statuses)
Jan Hrubane252a732017-01-03 15:03:09 +0100266 # comments increased by one for the start message
Jan Hruban37615e52015-11-19 14:30:49 +0100267 self.assertEqual(2, len(A.comments))
268 self.assertThat(A.comments[1],
Jan Hrubane252a732017-01-03 15:03:09 +0100269 MatchesRegex('.*Starting reporting jobs.*', re.DOTALL))
270 self.executor_server.hold_jobs_in_build = False
271 self.executor_server.release()
272 self.waitUntilSettled()
Jan Hruban37615e52015-11-19 14:30:49 +0100273 self.assertNotIn('reporting', A.statuses)
274 self.assertEqual(2, len(A.comments))
Jan Hruban49bff072015-11-03 11:45:46 +0100275
276 @simple_layout('layouts/merging-github.yaml', driver='github')
277 def test_report_pull_merge(self):
278 # pipeline merges the pull request on success
Jan Hruban3b415922016-02-03 13:10:22 +0100279 A = self.fake_github.openFakePullRequest('org/project', 'master',
280 'PR title')
Jan Hruban49bff072015-11-03 11:45:46 +0100281 self.fake_github.emitEvent(A.getCommentAddedEvent('merge me'))
282 self.waitUntilSettled()
283 self.assertTrue(A.is_merged)
Jan Hruban3b415922016-02-03 13:10:22 +0100284 self.assertThat(A.merge_message,
285 MatchesRegex('.*PR title.*Reviewed-by.*', re.DOTALL))
Jan Hruban49bff072015-11-03 11:45:46 +0100286
287 # pipeline merges the pull request on success after failure
288 self.fake_github.merge_failure = True
Jan Hruban37615e52015-11-19 14:30:49 +0100289 B = self.fake_github.openFakePullRequest('org/project', 'master', 'B')
Jan Hruban49bff072015-11-03 11:45:46 +0100290 self.fake_github.emitEvent(B.getCommentAddedEvent('merge me'))
291 self.waitUntilSettled()
292 self.assertFalse(B.is_merged)
293 self.fake_github.merge_failure = False
294
295 # pipeline merges the pull request on second run of merge
296 # first merge failed on 405 Method Not Allowed error
297 self.fake_github.merge_not_allowed_count = 1
Jan Hruban37615e52015-11-19 14:30:49 +0100298 C = self.fake_github.openFakePullRequest('org/project', 'master', 'C')
Jan Hruban49bff072015-11-03 11:45:46 +0100299 self.fake_github.emitEvent(C.getCommentAddedEvent('merge me'))
300 self.waitUntilSettled()
301 self.assertTrue(C.is_merged)
302
303 # pipeline does not merge the pull request
304 # merge failed on 405 Method Not Allowed error - twice
305 self.fake_github.merge_not_allowed_count = 2
Jan Hruban37615e52015-11-19 14:30:49 +0100306 D = self.fake_github.openFakePullRequest('org/project', 'master', 'D')
Jan Hruban49bff072015-11-03 11:45:46 +0100307 self.fake_github.emitEvent(D.getCommentAddedEvent('merge me'))
308 self.waitUntilSettled()
309 self.assertFalse(D.is_merged)
Jan Hruban37615e52015-11-19 14:30:49 +0100310
311 @simple_layout('layouts/dependent-github.yaml', driver='github')
312 def test_parallel_changes(self):
313 "Test that changes are tested in parallel and merged in series"
314
315 self.executor_server.hold_jobs_in_build = True
316 A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
317 B = self.fake_github.openFakePullRequest('org/project', 'master', 'B')
318 C = self.fake_github.openFakePullRequest('org/project', 'master', 'C')
319
320 self.fake_github.emitEvent(A.addLabel('merge'))
321 self.fake_github.emitEvent(B.addLabel('merge'))
322 self.fake_github.emitEvent(C.addLabel('merge'))
323
324 self.waitUntilSettled()
325 self.assertEqual(len(self.builds), 1)
326 self.assertEqual(self.builds[0].name, 'project-merge')
327 self.assertTrue(self.builds[0].hasChanges(A))
328
329 self.executor_server.release('.*-merge')
330 self.waitUntilSettled()
331 self.assertEqual(len(self.builds), 3)
332 self.assertEqual(self.builds[0].name, 'project-test1')
333 self.assertTrue(self.builds[0].hasChanges(A))
334 self.assertEqual(self.builds[1].name, 'project-test2')
335 self.assertTrue(self.builds[1].hasChanges(A))
336 self.assertEqual(self.builds[2].name, 'project-merge')
337 self.assertTrue(self.builds[2].hasChanges(A, B))
338
339 self.executor_server.release('.*-merge')
340 self.waitUntilSettled()
341 self.assertEqual(len(self.builds), 5)
342 self.assertEqual(self.builds[0].name, 'project-test1')
343 self.assertTrue(self.builds[0].hasChanges(A))
344 self.assertEqual(self.builds[1].name, 'project-test2')
345 self.assertTrue(self.builds[1].hasChanges(A))
346
347 self.assertEqual(self.builds[2].name, 'project-test1')
348 self.assertTrue(self.builds[2].hasChanges(A))
349 self.assertEqual(self.builds[3].name, 'project-test2')
350 self.assertTrue(self.builds[3].hasChanges(A, B))
351
352 self.assertEqual(self.builds[4].name, 'project-merge')
353 self.assertTrue(self.builds[4].hasChanges(A, B, C))
354
355 self.executor_server.release('.*-merge')
356 self.waitUntilSettled()
357 self.assertEqual(len(self.builds), 6)
358 self.assertEqual(self.builds[0].name, 'project-test1')
359 self.assertTrue(self.builds[0].hasChanges(A))
360 self.assertEqual(self.builds[1].name, 'project-test2')
361 self.assertTrue(self.builds[1].hasChanges(A))
362
363 self.assertEqual(self.builds[2].name, 'project-test1')
364 self.assertTrue(self.builds[2].hasChanges(A, B))
365 self.assertEqual(self.builds[3].name, 'project-test2')
366 self.assertTrue(self.builds[3].hasChanges(A, B))
367
368 self.assertEqual(self.builds[4].name, 'project-test1')
369 self.assertTrue(self.builds[4].hasChanges(A, B, C))
370 self.assertEqual(self.builds[5].name, 'project-test2')
371 self.assertTrue(self.builds[5].hasChanges(A, B, C))
372
373 all_builds = self.builds[:]
374 self.release(all_builds[2])
375 self.release(all_builds[3])
376 self.waitUntilSettled()
377 self.assertFalse(A.is_merged)
378 self.assertFalse(B.is_merged)
379 self.assertFalse(C.is_merged)
380
381 self.release(all_builds[0])
382 self.release(all_builds[1])
383 self.waitUntilSettled()
384 self.assertTrue(A.is_merged)
385 self.assertTrue(B.is_merged)
386 self.assertFalse(C.is_merged)
387
388 self.executor_server.hold_jobs_in_build = False
389 self.executor_server.release()
390 self.waitUntilSettled()
391 self.assertEqual(len(self.builds), 0)
392 self.assertEqual(len(self.history), 9)
393 self.assertTrue(C.is_merged)
394
395 self.assertNotIn('merge', A.labels)
396 self.assertNotIn('merge', B.labels)
397 self.assertNotIn('merge', C.labels)
398
399 @simple_layout('layouts/dependent-github.yaml', driver='github')
400 def test_failed_changes(self):
401 "Test that a change behind a failed change is retested"
402 self.executor_server.hold_jobs_in_build = True
403
404 A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
405 B = self.fake_github.openFakePullRequest('org/project', 'master', 'B')
406
407 self.executor_server.failJob('project-test1', A)
408
409 self.fake_github.emitEvent(A.addLabel('merge'))
410 self.fake_github.emitEvent(B.addLabel('merge'))
411 self.waitUntilSettled()
412
413 self.executor_server.release('.*-merge')
414 self.waitUntilSettled()
415
416 self.executor_server.hold_jobs_in_build = False
417 self.executor_server.release()
418
419 self.waitUntilSettled()
420 # It's certain that the merge job for change 2 will run, but
421 # the test1 and test2 jobs may or may not run.
422 self.assertTrue(len(self.history) > 6)
423 self.assertFalse(A.is_merged)
424 self.assertTrue(B.is_merged)
425 self.assertNotIn('merge', A.labels)
426 self.assertNotIn('merge', B.labels)
427
428 @simple_layout('layouts/dependent-github.yaml', driver='github')
429 def test_failed_change_at_head(self):
430 "Test that if a change at the head fails, jobs behind it are canceled"
431
432 self.executor_server.hold_jobs_in_build = True
433 A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
434 B = self.fake_github.openFakePullRequest('org/project', 'master', 'B')
435 C = self.fake_github.openFakePullRequest('org/project', 'master', 'C')
436
437 self.executor_server.failJob('project-test1', A)
438
439 self.fake_github.emitEvent(A.addLabel('merge'))
440 self.fake_github.emitEvent(B.addLabel('merge'))
441 self.fake_github.emitEvent(C.addLabel('merge'))
442
443 self.waitUntilSettled()
444
445 self.assertEqual(len(self.builds), 1)
446 self.assertEqual(self.builds[0].name, 'project-merge')
447 self.assertTrue(self.builds[0].hasChanges(A))
448
449 self.executor_server.release('.*-merge')
450 self.waitUntilSettled()
451 self.executor_server.release('.*-merge')
452 self.waitUntilSettled()
453 self.executor_server.release('.*-merge')
454 self.waitUntilSettled()
455
456 self.assertEqual(len(self.builds), 6)
457 self.assertEqual(self.builds[0].name, 'project-test1')
458 self.assertEqual(self.builds[1].name, 'project-test2')
459 self.assertEqual(self.builds[2].name, 'project-test1')
460 self.assertEqual(self.builds[3].name, 'project-test2')
461 self.assertEqual(self.builds[4].name, 'project-test1')
462 self.assertEqual(self.builds[5].name, 'project-test2')
463
464 self.release(self.builds[0])
465 self.waitUntilSettled()
466
467 # project-test2, project-merge for B
468 self.assertEqual(len(self.builds), 2)
469 self.assertEqual(self.countJobResults(self.history, 'ABORTED'), 4)
470
471 self.executor_server.hold_jobs_in_build = False
472 self.executor_server.release()
473 self.waitUntilSettled()
474
475 self.assertEqual(len(self.builds), 0)
476 self.assertEqual(len(self.history), 15)
477 self.assertFalse(A.is_merged)
478 self.assertTrue(B.is_merged)
479 self.assertTrue(C.is_merged)
480 self.assertNotIn('merge', A.labels)
481 self.assertNotIn('merge', B.labels)
482 self.assertNotIn('merge', C.labels)