Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@unittest.expectedFailure
def test_l10nbot_allowed_in_gate_and_submit(self):
gate = self.getPipeline('gate-and-submit').manager
change = zuul.model.Change('mediawiki/core')
l10n_event = zuul.model.TriggerEvent()
l10n_event.type = 'comment-added'
l10n_event.account = {'email': 'l10n-bot@translatewiki.net'}
l10n_event.approvals = [{'type': 'Code-Review',
'description': 'Code Review',
'value': '2',
'by': {'email': 'l10n-bot@translatewiki.net'},
}]
self.assertTrue(gate.eventMatches(l10n_event, change))
def test_pipelines_have_report_action_to_gerrit(self):
not_reporting = ['post', 'publish', 'codehealth']
required_actions = ['success', 'failure']
reporting_pipelines = [
p for p in self.getPipelines()
if p.name not in not_reporting]
for pipeline in reporting_pipelines:
for action in required_actions:
reporters = pipeline.__getattribute__(action + '_actions')
self.assertTrue(
# At least one reporter is to Gerrit
any([isinstance(reporter, GerritReporter)
for reporter in reporters]
),
'Pipeline %s must have a GerritReporter on %s got %s' % (
pipeline.name, action, reporters)
)
def test_l10nbot_patchets_are_ignored(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
l10n_event = zuul.model.TriggerEvent()
l10n_event.type = 'patchset-created'
l10n_event.account = {'email': 'l10n-bot@translatewiki.net'}
l10n_event.branch = change.branch
self.assertFalse(test_manager.eventMatches(l10n_event, change),
'l10-bot should not enter %s pipeline' %
test_manager.pipeline.name)
def test_recheck_comment_trusted_user(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
event = zuul.model.TriggerEvent()
event.type = 'comment-added'
event.comment = 'Patch Set 1:\n\nrecheck'
event.account = {'email': 'jdoe@wikimedia.org'}
event.branch = change.branch
self.assertTrue(test_manager.eventMatches(event, change))
def test_no_post_on_ref_tag_update(self):
manager = self.getPipeline('post').manager
change = zuul.model.Change('mediawiki/core')
event = zuul.model.TriggerEvent()
event.type = 'ref-updated'
event.ref = 'refs/tags/wmf/1.29.0-wmf.20'
self.assertFalse(manager.eventMatches(event, change))
def test_gated_extension_run_tests_on_feature_branch(self):
repo = 'mediawiki/extensions/CirrusSearch'
release_job = self.getJob(
repo, 'test',
'wmf-quibble-vendor-mysql-php72-docker')
change = zuul.model.Change(repo)
change.branch = 'es6'
self.assertTrue(release_job.changeMatches(change))
def test_recheck_with_inline_comment_removed_review(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
event = zuul.model.TriggerEvent()
event.type = 'comment-added'
event.comment = 'Patch Set 1: -Code-Review\n\n(2 comments)\n\nrecheck'
event.account = {'email': 'jdoe@wikimedia.org'}
event.branch = change.branch
self.assertTrue(test_manager.eventMatches(event, change))
'mediawiki-quibble-composer-mysql-php72-docker': True,
'mediawiki-quibble-vendor-mysql-php74-docker': True,
'mediawiki-quibble-vendor-mysql-php73-docker': True,
'mediawiki-quibble-vendor-mysql-php72-docker': True,
'mediawiki-quibble-composertest-php72-docker': True,
'mediawiki-quibble-apitests-vendor-docker': True,
'mediawiki-quibble-selenium-vendor-docker': True,
'mediawiki-quibble-vendor-sqlite-php72-docker': True,
'mediawiki-quibble-vendor-postgres-php72-docker': True,
'wmf-quibble-vendor-mysql-php72-docker': False,
'wmf-quibble-selenium-php72-docker': True,
'wmf-quibble-core-vendor-mysql-php72-docker': True,
'mwgate-node10-docker': True,
}
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
change.files.extend(['foo.php', 'composer.json'])
job_tree = [t for (p, t) in
self.getPipeline('test').job_trees.iteritems()
if p.name == 'mediawiki/core'][0]
test_jobs = job_tree.getJobs()
job_tree = [t for (p, t) in
self.getPipeline('gate-and-submit').job_trees.iteritems()
if p.name == 'mediawiki/core'][0]
gate_jobs = job_tree.getJobs()
expected_jobs = {
'test': set(expected_test),
'gate-and-submit': set(expected_gate),
}
def test_recheck_with_verified_vote_minus_two(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
event = zuul.model.TriggerEvent()
event.type = 'comment-added'
event.comment = 'Patch Set 1: Verified-2\n\nrecheck'
event.account = {'email': 'jdoe@wikimedia.org'}
event.branch = change.branch
self.assertFalse(test_manager.eventMatches(event, change))
def change_with_files(files):
change = zuul.model.Change('mediawiki/ruby/api')
change.branch = 'master'
change.files.extend(files)
return change