How to use the zuul.connection.gerrit.GerritConnection function in zuul

To help you get started, we’ve selected a few zuul examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikimedia / integration-config / tests / test_zuul_scheduler.py View on Github external
def test_postmerge_gerrit_review_command(self):
        pipe = self.getPipeline('postmerge')
        # Pick the first Gerrit success reporter
        gerrit_reporter = [r for r in pipe.success_actions
                           if isinstance(r, GerritReporter)][0]

        # There is no verified/code-review configured:
        self.assertEquals(
            {'tag': 'autogenerated:ci'},
            gerrit_reporter.reporter_config)

        gerrit = GerritConnection('fake_gerrit',
                                  {'server': 'localhost', 'user': 'john'})
        # Fake ssh (stdout, stderr) so the command is returned by review()
        gerrit._ssh = lambda x: ['', x]
        cmd = gerrit.review('some/project', '12345,42', 'hello world',
                            gerrit_reporter.reporter_config)
        self.longMessage = True
        self.assertEquals(
            'gerrit review --project some/project '
            '--message "hello world" --tag autogenerated:ci 12345,42',
            cmd,
            'gerrit review command does not match Gerrit 2.13 expectation')
github wikimedia / integration-config / tests / test_zuul_scheduler.py View on Github external
def test_all_gerrit_reporters_use_tagged_comment(self):
        gerrit = GerritConnection('fake_gerrit',
                                  {'server': 'localhost', 'user': 'jane'})
        # Fake ssh (stdout, stderr) so the command is returned by review()
        gerrit._ssh = lambda x: ['', x]

        errors = []
        for pipeline in self.getPipelines():
            for action in self.sched._reporter_actions.values():
                # Note: when unset:
                # merge-failure action defaults to failure action
                # disabled action defaults to success action
                for reporter in [r for r in getattr(pipeline, action, [])
                                 if isinstance(r, GerritReporter)]:
                    cmd = gerrit.review(
                        'some/project', '12345,42',
                        '%s action on %s pipeline' % (action, pipeline.name),
                        reporter.reporter_config)