Check that empty reports aren't sent
Unittest scenario: 1) Project with only one job in check pipeline (3rd party CI scenario) 2) That job has "files" restriction, which the default test change doesn't match. 3) Item is not reported, and is deleted from the queue. Change-Id: I2ba6558111f67061476f8857b4f10019d2750a68
This commit is contained in:
parent
88db9cb888
commit
d6e546c30f
@ -892,6 +892,7 @@ class ZuulTestCase(BaseTestCase):
|
||||
self.init_repo("org/conflict-project")
|
||||
self.init_repo("org/noop-project")
|
||||
self.init_repo("org/experimental-project")
|
||||
self.init_repo("org/no-jobs-project")
|
||||
|
||||
self.statsd = FakeStatsd()
|
||||
os.environ['STATSD_HOST'] = 'localhost'
|
||||
|
4
tests/fixtures/layout.yaml
vendored
4
tests/fixtures/layout.yaml
vendored
@ -246,3 +246,7 @@ projects:
|
||||
- name: org/experimental-project
|
||||
experimental:
|
||||
- experimental-project-test
|
||||
|
||||
- name: org/no-jobs-project
|
||||
check:
|
||||
- project-testfile
|
||||
|
@ -1878,6 +1878,23 @@ class TestScheduler(ZuulTestCase):
|
||||
self.assertEqual(A.data['status'], 'MERGED')
|
||||
self.assertEqual(A.reported, 2)
|
||||
|
||||
def test_no_job_project(self):
|
||||
"Test that reports with no jobs don't get sent"
|
||||
A = self.fake_gerrit.addFakeChange('org/no-jobs-project',
|
||||
'master', 'A')
|
||||
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
# Change wasn't reported to
|
||||
self.assertEqual(A.reported, False)
|
||||
|
||||
# Check queue is empty afterwards
|
||||
check_pipeline = self.sched.layout.pipelines['check']
|
||||
items = check_pipeline.getAllItems()
|
||||
self.assertEqual(len(items), 0)
|
||||
|
||||
self.assertEqual(len(self.history), 0)
|
||||
|
||||
def test_zuul_refs(self):
|
||||
"Test that zuul refs exist and have the right changes"
|
||||
self.worker.hold_jobs_in_build = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user