Bug 1247085 - Generate empty graph when no try flags given r=wcosta

MozReview-Commit-ID: DOq9gJBTUY6
This commit is contained in:
Gregory Arndt 2016-02-29 09:51:17 -06:00
parent 87f6a2c993
commit 496887d1d6
3 changed files with 44 additions and 32 deletions

View File

@ -308,15 +308,8 @@ class Graph(object):
project = params['project']
message = params.get('message', '') if project == 'try' else DEFAULT_TRY
# Message would only be blank when not created from decision task
if project == 'try' and not message:
sys.stderr.write(
"Must supply commit message when creating try graph. " \
"Example: --message='try: -b do -p all -u all'"
)
sys.exit(1)
templates = Templates(ROOT)
job_path = os.path.join(ROOT, 'tasks', 'branches', project, 'job_flags.yml')
job_path = job_path if os.path.exists(job_path) else DEFAULT_JOB_PATH

View File

@ -20,9 +20,6 @@ BUILD_TYPE_ALIASES = {
'd': 'debug'
}
class InvalidCommitException(Exception):
pass
def escape_whitespace_in_brackets(input_str):
'''
In tests you may restrict them by platform [] inside of the brackets
@ -249,8 +246,7 @@ def parse_commit(message, jobs):
break
if try_idx is None:
raise InvalidCommitException('Invalid commit format contain ' +
TRY_DELIMITER)
return [], 0
# Argument parser based on try flag flags
parser = argparse.ArgumentParser()

View File

@ -8,8 +8,7 @@ import unittest
import mozunit
from taskcluster_graph.commit_parser import (
parse_commit,
normalize_test_list,
InvalidCommitException
normalize_test_list
)
class TestCommitParser(unittest.TestCase):
@ -82,13 +81,6 @@ class TestCommitParser(unittest.TestCase):
{ 'test': t, 'only_chunks': set([1, 4])} for t in ['foo', 'bar', 'bing']])
)
def test_invalid_commit(self):
'''
Disallow invalid commit messages from being parsed...
'''
with self.assertRaises(InvalidCommitException):
parse_commit("wootbarbaz", {})
def test_commit_no_tests(self):
'''
This test covers the case of builds but no tests passed -u none
@ -126,7 +118,7 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_flag_aliasing(self):
@ -166,7 +158,7 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_try_flag_in_middle_of_commit(self):
@ -207,9 +199,39 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_try_flags_not_specified(self):
'''
Try flags are optional, and if not provided, should cause an empty graph
to be generated.
'''
commit = 'Bug XXX - test commit with no flags'
jobs = {
'flags': {
'builds': ['linux', 'linux64'],
'tests': ['web-platform-tests'],
},
'builds': {
'linux': {
'types': {
'opt': {
'task': 'task/linux',
},
'debug': {
'task': 'task/linux-debug'
}
}
},
},
'tests': {}
}
expected = []
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_commit_all_builds_no_tests(self):
'''
@ -248,7 +270,7 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_some_test_tasks_restricted(self):
@ -311,9 +333,10 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_specific_test_platforms(self):
'''
This test cases covers the platform specific test exclusion options.
@ -420,7 +443,7 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_specific_test_platforms_with_specific_platform(self):
@ -500,7 +523,7 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_specific_chunks(self):
@ -558,7 +581,7 @@ class TestCommitParser(unittest.TestCase):
'interactive': False,
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_commit_with_builds_and_tests(self):
@ -705,7 +728,7 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)
def test_commit_with_builds_and_tests(self):
@ -866,7 +889,7 @@ class TestCommitParser(unittest.TestCase):
}
]
result = parse_commit(commit, jobs)
result, triggers = parse_commit(commit, jobs)
self.assertEqual(expected, result)