blob: a33353a9d4f0cbb3c4bdfa619ea0c60571e019cf [file] [log] [blame]
James E. Blair9c17dbf2014-06-23 14:21:58 -07001#!/usr/bin/env python
2
3# Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
17import logging
18import time
Jamie Lennoxff3e0b92016-11-23 10:38:25 +110019from unittest import skip
James E. Blair9c17dbf2014-06-23 14:21:58 -070020
21from tests.base import ZuulTestCase
22
23logging.basicConfig(level=logging.DEBUG,
24 format='%(asctime)s %(name)-32s '
25 '%(levelname)-8s %(message)s')
26
27
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110028class TestRequirementsApprovalNewerThan(ZuulTestCase):
29 """Requirements with a newer-than comment requirement"""
James E. Blair9c17dbf2014-06-23 14:21:58 -070030
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110031 tenant_config_file = 'config/requirements/newer-than/main.yaml'
32
James E. Blair9c17dbf2014-06-23 14:21:58 -070033 def test_pipeline_require_approval_newer_than(self):
34 "Test pipeline requirement: approval newer than"
35 return self._test_require_approval_newer_than('org/project1',
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110036 'project1-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -070037
38 def test_trigger_require_approval_newer_than(self):
39 "Test trigger requirement: approval newer than"
40 return self._test_require_approval_newer_than('org/project2',
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110041 'project2-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -070042
43 def _test_require_approval_newer_than(self, project, job):
James E. Blair9c17dbf2014-06-23 14:21:58 -070044 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
45 # A comment event that we will keep submitting to trigger
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110046 comment = A.addApproval('code-review', 2, username='nobody')
James E. Blair9c17dbf2014-06-23 14:21:58 -070047 self.fake_gerrit.addEvent(comment)
48 self.waitUntilSettled()
49 # No +1 from Jenkins so should not be enqueued
50 self.assertEqual(len(self.history), 0)
51
52 # Add a too-old +1, should not be enqueued
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110053 A.addApproval('verified', 1, username='jenkins',
Joshua Hesketh642824b2014-07-01 17:54:59 +100054 granted_on=time.time() - 72 * 60 * 60)
James E. Blair9c17dbf2014-06-23 14:21:58 -070055 self.fake_gerrit.addEvent(comment)
56 self.waitUntilSettled()
57 self.assertEqual(len(self.history), 0)
58
59 # Add a recent +1
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110060 self.fake_gerrit.addEvent(A.addApproval('verified', 1,
61 username='jenkins'))
James E. Blair9c17dbf2014-06-23 14:21:58 -070062 self.fake_gerrit.addEvent(comment)
63 self.waitUntilSettled()
64 self.assertEqual(len(self.history), 1)
65 self.assertEqual(self.history[0].name, job)
66
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110067
Jamie Lennox8faa71e2016-11-23 14:33:52 +110068class TestRequirementsApprovalOlderThan(ZuulTestCase):
69 """Requirements with a older-than comment requirement"""
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110070
Jamie Lennox8faa71e2016-11-23 14:33:52 +110071 tenant_config_file = 'config/requirements/older-than/main.yaml'
Jamie Lennoxb59a73f2016-11-23 14:27:18 +110072
James E. Blair9c17dbf2014-06-23 14:21:58 -070073 def test_pipeline_require_approval_older_than(self):
74 "Test pipeline requirement: approval older than"
75 return self._test_require_approval_older_than('org/project1',
Jamie Lennox8faa71e2016-11-23 14:33:52 +110076 'project1-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -070077
78 def test_trigger_require_approval_older_than(self):
79 "Test trigger requirement: approval older than"
80 return self._test_require_approval_older_than('org/project2',
Jamie Lennox8faa71e2016-11-23 14:33:52 +110081 'project2-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -070082
83 def _test_require_approval_older_than(self, project, job):
James E. Blair9c17dbf2014-06-23 14:21:58 -070084 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
85 # A comment event that we will keep submitting to trigger
Jamie Lennox8faa71e2016-11-23 14:33:52 +110086 comment = A.addApproval('code-review', 2, username='nobody')
James E. Blair9c17dbf2014-06-23 14:21:58 -070087 self.fake_gerrit.addEvent(comment)
88 self.waitUntilSettled()
89 # No +1 from Jenkins so should not be enqueued
90 self.assertEqual(len(self.history), 0)
91
92 # Add a recent +1 which should not be enqueued
Jamie Lennox8faa71e2016-11-23 14:33:52 +110093 A.addApproval('verified', 1)
James E. Blair9c17dbf2014-06-23 14:21:58 -070094 self.fake_gerrit.addEvent(comment)
95 self.waitUntilSettled()
96 self.assertEqual(len(self.history), 0)
97
98 # Add an old +1 which should be enqueued
Jamie Lennox8faa71e2016-11-23 14:33:52 +110099 A.addApproval('verified', 1, username='jenkins',
Joshua Hesketh642824b2014-07-01 17:54:59 +1000100 granted_on=time.time() - 72 * 60 * 60)
James E. Blair9c17dbf2014-06-23 14:21:58 -0700101 self.fake_gerrit.addEvent(comment)
102 self.waitUntilSettled()
103 self.assertEqual(len(self.history), 1)
104 self.assertEqual(self.history[0].name, job)
105
Jamie Lennox8faa71e2016-11-23 14:33:52 +1100106
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100107class TestRequirementsUserName(ZuulTestCase):
108 """Requirements with a username requirement"""
Jamie Lennox8faa71e2016-11-23 14:33:52 +1100109
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100110 tenant_config_file = 'config/requirements/username/main.yaml'
Jamie Lennox8faa71e2016-11-23 14:33:52 +1100111
James E. Blair9c17dbf2014-06-23 14:21:58 -0700112 def test_pipeline_require_approval_username(self):
113 "Test pipeline requirement: approval username"
114 return self._test_require_approval_username('org/project1',
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100115 'project1-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700116
117 def test_trigger_require_approval_username(self):
118 "Test trigger requirement: approval username"
119 return self._test_require_approval_username('org/project2',
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100120 'project2-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700121
122 def _test_require_approval_username(self, project, job):
James E. Blair9c17dbf2014-06-23 14:21:58 -0700123 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
124 # A comment event that we will keep submitting to trigger
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100125 comment = A.addApproval('code-review', 2, username='nobody')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700126 self.fake_gerrit.addEvent(comment)
127 self.waitUntilSettled()
128 # No approval from Jenkins so should not be enqueued
129 self.assertEqual(len(self.history), 0)
130
131 # Add an approval from Jenkins
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100132 A.addApproval('verified', 1, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700133 self.fake_gerrit.addEvent(comment)
134 self.waitUntilSettled()
135 self.assertEqual(len(self.history), 1)
136 self.assertEqual(self.history[0].name, job)
137
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100138
Jamie Lennox90cb6b92016-11-23 14:37:19 +1100139class TestRequirementsEmail(ZuulTestCase):
140 """Requirements with a email requirement"""
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100141
Jamie Lennox90cb6b92016-11-23 14:37:19 +1100142 tenant_config_file = 'config/requirements/email/main.yaml'
Jamie Lennoxdb3b4e02016-11-23 14:36:12 +1100143
James E. Blair9c17dbf2014-06-23 14:21:58 -0700144 def test_pipeline_require_approval_email(self):
145 "Test pipeline requirement: approval email"
146 return self._test_require_approval_email('org/project1',
Jamie Lennox90cb6b92016-11-23 14:37:19 +1100147 'project1-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700148
149 def test_trigger_require_approval_email(self):
150 "Test trigger requirement: approval email"
151 return self._test_require_approval_email('org/project2',
Jamie Lennox90cb6b92016-11-23 14:37:19 +1100152 'project2-job')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700153
154 def _test_require_approval_email(self, project, job):
James E. Blair9c17dbf2014-06-23 14:21:58 -0700155 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
156 # A comment event that we will keep submitting to trigger
Jamie Lennox90cb6b92016-11-23 14:37:19 +1100157 comment = A.addApproval('code-review', 2, username='nobody')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700158 self.fake_gerrit.addEvent(comment)
159 self.waitUntilSettled()
160 # No approval from Jenkins so should not be enqueued
161 self.assertEqual(len(self.history), 0)
162
163 # Add an approval from Jenkins
Jamie Lennox90cb6b92016-11-23 14:37:19 +1100164 A.addApproval('verified', 1, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700165 self.fake_gerrit.addEvent(comment)
166 self.waitUntilSettled()
167 self.assertEqual(len(self.history), 1)
168 self.assertEqual(self.history[0].name, job)
169
Jamie Lennox90cb6b92016-11-23 14:37:19 +1100170
171class TestRequirements(ZuulTestCase):
172 """Test pipeline and trigger requirements"""
173
174 tenant_config_file = 'config/requirements/main.yaml'
175
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100176 @skip("Disabled for early v3 development")
James E. Blair9c17dbf2014-06-23 14:21:58 -0700177 def test_pipeline_require_approval_vote1(self):
178 "Test pipeline requirement: approval vote with one value"
179 return self._test_require_approval_vote1('org/project1',
180 'project1-pipeline')
181
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100182 @skip("Disabled for early v3 development")
James E. Blair9c17dbf2014-06-23 14:21:58 -0700183 def test_trigger_require_approval_vote1(self):
184 "Test trigger requirement: approval vote with one value"
185 return self._test_require_approval_vote1('org/project2',
186 'project2-trigger')
187
188 def _test_require_approval_vote1(self, project, job):
James E. Blairf84026c2015-12-08 16:11:46 -0800189 self.updateConfigLayout(
190 'tests/fixtures/layout-requirement-vote1.yaml')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700191 self.sched.reconfigure(self.config)
192 self.registerJobs()
193
194 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
195 # A comment event that we will keep submitting to trigger
196 comment = A.addApproval('CRVW', 2, username='nobody')
197 self.fake_gerrit.addEvent(comment)
198 self.waitUntilSettled()
199 # No approval from Jenkins so should not be enqueued
200 self.assertEqual(len(self.history), 0)
201
202 # A -1 from jenkins should not cause it to be enqueued
Joshua Hesketh642824b2014-07-01 17:54:59 +1000203 A.addApproval('VRFY', -1, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700204 self.fake_gerrit.addEvent(comment)
205 self.waitUntilSettled()
206 self.assertEqual(len(self.history), 0)
207
208 # A +1 should allow it to be enqueued
Joshua Hesketh642824b2014-07-01 17:54:59 +1000209 A.addApproval('VRFY', 1, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700210 self.fake_gerrit.addEvent(comment)
211 self.waitUntilSettled()
212 self.assertEqual(len(self.history), 1)
213 self.assertEqual(self.history[0].name, job)
214
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100215 @skip("Disabled for early v3 development")
James E. Blair9c17dbf2014-06-23 14:21:58 -0700216 def test_pipeline_require_approval_vote2(self):
217 "Test pipeline requirement: approval vote with two values"
218 return self._test_require_approval_vote2('org/project1',
219 'project1-pipeline')
220
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100221 @skip("Disabled for early v3 development")
James E. Blair9c17dbf2014-06-23 14:21:58 -0700222 def test_trigger_require_approval_vote2(self):
223 "Test trigger requirement: approval vote with two values"
224 return self._test_require_approval_vote2('org/project2',
225 'project2-trigger')
226
227 def _test_require_approval_vote2(self, project, job):
James E. Blairf84026c2015-12-08 16:11:46 -0800228 self.updateConfigLayout(
229 'tests/fixtures/layout-requirement-vote2.yaml')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700230 self.sched.reconfigure(self.config)
231 self.registerJobs()
232
233 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
234 # A comment event that we will keep submitting to trigger
235 comment = A.addApproval('CRVW', 2, username='nobody')
236 self.fake_gerrit.addEvent(comment)
237 self.waitUntilSettled()
238 # No approval from Jenkins so should not be enqueued
239 self.assertEqual(len(self.history), 0)
240
241 # A -1 from jenkins should not cause it to be enqueued
Joshua Hesketh642824b2014-07-01 17:54:59 +1000242 A.addApproval('VRFY', -1, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700243 self.fake_gerrit.addEvent(comment)
244 self.waitUntilSettled()
245 self.assertEqual(len(self.history), 0)
246
247 # A -2 from jenkins should not cause it to be enqueued
Joshua Hesketh642824b2014-07-01 17:54:59 +1000248 A.addApproval('VRFY', -2, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700249 self.fake_gerrit.addEvent(comment)
250 self.waitUntilSettled()
251 self.assertEqual(len(self.history), 0)
252
Joshua Hesketh642824b2014-07-01 17:54:59 +1000253 # A +1 from jenkins should allow it to be enqueued
254 A.addApproval('VRFY', 1, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700255 self.fake_gerrit.addEvent(comment)
256 self.waitUntilSettled()
257 self.assertEqual(len(self.history), 1)
258 self.assertEqual(self.history[0].name, job)
259
260 # A +2 should allow it to be enqueued
261 B = self.fake_gerrit.addFakeChange(project, 'master', 'B')
262 # A comment event that we will keep submitting to trigger
263 comment = B.addApproval('CRVW', 2, username='nobody')
264 self.fake_gerrit.addEvent(comment)
265 self.waitUntilSettled()
266 self.assertEqual(len(self.history), 1)
267
Joshua Hesketh642824b2014-07-01 17:54:59 +1000268 B.addApproval('VRFY', 2, username='jenkins')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700269 self.fake_gerrit.addEvent(comment)
270 self.waitUntilSettled()
271 self.assertEqual(len(self.history), 2)
272 self.assertEqual(self.history[1].name, job)
273
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100274 @skip("Disabled for early v3 development")
James E. Blair9c17dbf2014-06-23 14:21:58 -0700275 def test_pipeline_require_current_patchset(self):
276 "Test pipeline requirement: current-patchset"
James E. Blairf84026c2015-12-08 16:11:46 -0800277 self.updateConfigLayout(
278 'tests/fixtures/layout-requirement-current-patchset.yaml')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700279 self.sched.reconfigure(self.config)
280 self.registerJobs()
281 # Create two patchsets and let their tests settle out. Then
282 # comment on first patchset and check that no additional
283 # jobs are run.
284 A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
285 self.fake_gerrit.addEvent(A.addApproval('CRVW', 1))
286 self.waitUntilSettled()
287 A.addPatchset()
288 self.fake_gerrit.addEvent(A.addApproval('CRVW', 1))
289 self.waitUntilSettled()
290
291 self.assertEqual(len(self.history), 2) # one job for each ps
292 self.fake_gerrit.addEvent(A.getChangeCommentEvent(1))
293 self.waitUntilSettled()
294
295 # Assert no new jobs ran after event for old patchset.
296 self.assertEqual(len(self.history), 2)
297
298 # Make sure the same event on a new PS will trigger
299 self.fake_gerrit.addEvent(A.getChangeCommentEvent(2))
300 self.waitUntilSettled()
301 self.assertEqual(len(self.history), 3)
302
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100303 @skip("Disabled for early v3 development")
James E. Blair9c17dbf2014-06-23 14:21:58 -0700304 def test_pipeline_require_open(self):
305 "Test pipeline requirement: open"
James E. Blairf84026c2015-12-08 16:11:46 -0800306 self.updateConfigLayout(
307 'tests/fixtures/layout-requirement-open.yaml')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700308 self.sched.reconfigure(self.config)
309 self.registerJobs()
310
311 A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A',
312 status='MERGED')
313 self.fake_gerrit.addEvent(A.addApproval('CRVW', 2))
314 self.waitUntilSettled()
315 self.assertEqual(len(self.history), 0)
316
317 B = self.fake_gerrit.addFakeChange('org/project', 'master', 'B')
318 self.fake_gerrit.addEvent(B.addApproval('CRVW', 2))
319 self.waitUntilSettled()
320 self.assertEqual(len(self.history), 1)
321
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100322 @skip("Disabled for early v3 development")
James E. Blair9c17dbf2014-06-23 14:21:58 -0700323 def test_pipeline_require_status(self):
324 "Test pipeline requirement: status"
James E. Blairf84026c2015-12-08 16:11:46 -0800325 self.updateConfigLayout(
326 'tests/fixtures/layout-requirement-status.yaml')
James E. Blair9c17dbf2014-06-23 14:21:58 -0700327 self.sched.reconfigure(self.config)
328 self.registerJobs()
329
330 A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A',
331 status='MERGED')
332 self.fake_gerrit.addEvent(A.addApproval('CRVW', 2))
333 self.waitUntilSettled()
334 self.assertEqual(len(self.history), 0)
335
336 B = self.fake_gerrit.addFakeChange('org/project', 'master', 'B')
337 self.fake_gerrit.addEvent(B.addApproval('CRVW', 2))
338 self.waitUntilSettled()
339 self.assertEqual(len(self.history), 1)
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000340
341 def _test_require_reject_username(self, project, job):
342 "Test negative username's match"
343 # Should only trigger if Jenkins hasn't voted.
James E. Blairf84026c2015-12-08 16:11:46 -0800344 self.updateConfigLayout(
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000345 'tests/fixtures/layout-requirement-reject-username.yaml')
346 self.sched.reconfigure(self.config)
347 self.registerJobs()
348
349 # add in a change with no comments
350 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
351 self.waitUntilSettled()
352 self.assertEqual(len(self.history), 0)
353
354 # add in a comment that will trigger
355 self.fake_gerrit.addEvent(A.addApproval('CRVW', 1,
356 username='reviewer'))
357 self.waitUntilSettled()
358 self.assertEqual(len(self.history), 1)
359 self.assertEqual(self.history[0].name, job)
360
361 # add in a comment from jenkins user which shouldn't trigger
362 self.fake_gerrit.addEvent(A.addApproval('VRFY', 1, username='jenkins'))
363 self.waitUntilSettled()
364 self.assertEqual(len(self.history), 1)
365
366 # Check future reviews also won't trigger as a 'jenkins' user has
367 # commented previously
368 self.fake_gerrit.addEvent(A.addApproval('CRVW', 1,
369 username='reviewer'))
370 self.waitUntilSettled()
371 self.assertEqual(len(self.history), 1)
372
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100373 @skip("Disabled for early v3 development")
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000374 def test_pipeline_reject_username(self):
375 "Test negative pipeline requirement: no comment from jenkins"
376 return self._test_require_reject_username('org/project1',
377 'project1-pipeline')
378
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100379 @skip("Disabled for early v3 development")
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000380 def test_trigger_reject_username(self):
381 "Test negative trigger requirement: no comment from jenkins"
382 return self._test_require_reject_username('org/project2',
383 'project2-trigger')
384
385 def _test_require_reject(self, project, job):
386 "Test no approval matches a reject param"
James E. Blairf84026c2015-12-08 16:11:46 -0800387 self.updateConfigLayout(
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000388 'tests/fixtures/layout-requirement-reject.yaml')
389 self.sched.reconfigure(self.config)
390 self.registerJobs()
391
392 A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
393 self.waitUntilSettled()
394 self.assertEqual(len(self.history), 0)
395
396 # First positive vote should not queue until jenkins has +1'd
397 comment = A.addApproval('VRFY', 1, username='reviewer_a')
398 self.fake_gerrit.addEvent(comment)
399 self.waitUntilSettled()
400 self.assertEqual(len(self.history), 0)
401
402 # Jenkins should put in a +1 which will also queue
403 comment = A.addApproval('VRFY', 1, username='jenkins')
404 self.fake_gerrit.addEvent(comment)
405 self.waitUntilSettled()
406 self.assertEqual(len(self.history), 1)
407 self.assertEqual(self.history[0].name, job)
408
409 # Negative vote should not queue
410 comment = A.addApproval('VRFY', -1, username='reviewer_b')
411 self.fake_gerrit.addEvent(comment)
412 self.waitUntilSettled()
413 self.assertEqual(len(self.history), 1)
414
415 # Future approvals should do nothing
416 comment = A.addApproval('VRFY', 1, username='reviewer_c')
417 self.fake_gerrit.addEvent(comment)
418 self.waitUntilSettled()
419 self.assertEqual(len(self.history), 1)
420
421 # Change/update negative vote should queue
422 comment = A.addApproval('VRFY', 1, username='reviewer_b')
423 self.fake_gerrit.addEvent(comment)
424 self.waitUntilSettled()
425 self.assertEqual(len(self.history), 2)
426 self.assertEqual(self.history[1].name, job)
427
428 # Future approvals should also queue
429 comment = A.addApproval('VRFY', 1, username='reviewer_d')
430 self.fake_gerrit.addEvent(comment)
431 self.waitUntilSettled()
432 self.assertEqual(len(self.history), 3)
433 self.assertEqual(self.history[2].name, job)
434
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100435 @skip("Disabled for early v3 development")
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000436 def test_pipeline_require_reject(self):
437 "Test pipeline requirement: rejections absent"
438 return self._test_require_reject('org/project1', 'project1-pipeline')
439
Jamie Lennoxff3e0b92016-11-23 10:38:25 +1100440 @skip("Disabled for early v3 development")
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000441 def test_trigger_require_reject(self):
442 "Test trigger requirement: rejections absent"
443 return self._test_require_reject('org/project2', 'project2-trigger')