blob: e38fc6725875df1df5210ce73599199210e74206 [file] [log] [blame]
Jan Hruban3c440b02016-11-11 16:43:31 +01001# Copyright 2015 GoodData
2# Copyright (c) 2017 IBM Corp.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import logging
17from tests.base import ZuulTestCase
18
19logging.basicConfig(level=logging.DEBUG,
20 format='%(asctime)s %(name)-32s '
21 '%(levelname)-8s %(message)s')
22
23
24class TestGerritAndGithub(ZuulTestCase):
25 config_file = 'zuul-connections-gerrit-and-github.conf'
26 tenant_config_file = 'config/multi-driver/main.yaml'
27
28 def setup_config(self):
29 super(TestGerritAndGithub, self).setup_config()
30
31 def test_multiple_project_gerrit_and_github(self):
32 self.executor_server.hold_jobs_in_build = True
33
34 A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
35 self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
36
37 B = self.fake_github.openFakePullRequest('org/project1', 'master', 'B')
38 self.fake_github.emitEvent(B.getPullRequestOpenedEvent())
39
40 self.waitUntilSettled()
41
42 self.assertEqual(2, len(self.builds))
43 self.assertEqual('project-gerrit', self.builds[0].name)
44 self.assertEqual('project1-github', self.builds[1].name)
45 self.assertTrue(self.builds[0].hasChanges(A))
46 self.assertTrue(self.builds[1].hasChanges(B))
47
48 self.executor_server.hold_jobs_in_build = False
49 self.executor_server.release()
50 self.waitUntilSettled()