teuthology_branch = args['--teuthology-branch']
machine_type = args['--machine-type']
distro = args['--distro']
- suite_branch = args['--suite-branch'] or ceph_branch
+ suite_branch = args['--suite-branch']
suite_dir = args['--suite-dir']
limit = int(args['--limit'])
name = make_run_name(suite, ceph_branch, kernel_branch, kernel_flavor,
machine_type)
+ job_config = create_initial_config(suite, suite_branch, ceph_branch,
+ teuthology_branch, kernel_branch,
+ kernel_flavor, distro, machine_type)
+
if suite_dir:
suite_repo_path = suite_dir
else:
- suite_repo_path = fetch_suite_repo(suite_branch, test_name=name)
-
- job_config = create_initial_config(suite, ceph_branch,
- teuthology_branch, kernel_branch,
- kernel_flavor, distro, machine_type)
+ suite_repo_path = fetch_suite_repo(job_config.suite_branch,
+ test_name=name)
job_config.name = name
job_config.priority = priority
job_config.email = email
if owner:
job_config.owner = owner
- if suite_branch:
- job_config.suite_branch = suite_branch
with NamedTemporaryFile(prefix='schedule_suite_',
delete=False) as base_yaml:
return suite_repo_path
-def create_initial_config(suite, ceph_branch, teuthology_branch,
+def create_initial_config(suite, suite_branch, ceph_branch, teuthology_branch,
kernel_branch, kernel_flavor, distro, machine_type):
"""
Put together the config file used as the basis for each job in the run.
branches specified and specifies them so we know exactly what we're
testing.
- :returns: A yaml-formatted string
+ :returns: A JobConfig object
"""
# Put together a stanza specifying the kernel hash
if kernel_branch == 'distro':
# Get the ceph hash
ceph_hash = get_hash('ceph', ceph_branch, kernel_flavor, machine_type)
if not ceph_hash:
- schedule_fail("Ceph branch '{branch}' not found".format(
- branch=ceph_branch))
+ exc = BranchNotFoundError(ceph_branch, 'ceph.git')
+ schedule_fail(message=str(exc))
log.info("ceph sha1: {hash}".format(hash=ceph_hash))
# Get the ceph package version
s3_branch = ceph_branch
else:
log.info("branch {0} not in s3-tests.git; will use master for"
- "s3-tests".format(ceph_branch))
+ " s3-tests".format(ceph_branch))
s3_branch = 'master'
log.info("s3-tests branch: %s", s3_branch)
- if not teuthology_branch:
+ if teuthology_branch:
+ if not get_branch_info('teuthology', teuthology_branch):
+ exc = BranchNotFoundError(teuthology_branch, 'teuthology.git')
+ raise schedule_fail(message=str(exc))
+ else:
# Decide what branch of teuthology to use
if get_branch_info('teuthology', ceph_branch):
teuthology_branch = ceph_branch
else:
log.info("branch {0} not in teuthology.git; will use master for"
- "teuthology".format(ceph_branch))
+ " teuthology".format(ceph_branch))
teuthology_branch = 'master'
log.info("teuthology branch: %s", teuthology_branch)
+ if not suite_branch:
+ # Decide what branch of ceph-qa-suite to use
+ if get_branch_info('ceph-qa-suite', ceph_branch):
+ suite_branch = ceph_branch
+ else:
+ log.info("branch {0} not in ceph-qa-suite.git; will use master for"
+ " ceph-qa-suite".format(ceph_branch))
+ suite_branch = 'master'
+ log.info("ceph-qa-suite branch: %s", suite_branch)
+
config_input = dict(
suite=suite,
+ suite_branch=suite_branch,
ceph_branch=ceph_branch,
ceph_hash=ceph_hash,
teuthology_branch=teuthology_branch,
self.name = name
def __str__(self):
- return "Job scheduling {name} failed: '{msg}'".format(
+ return "Job scheduling {name} failed: {msg}".format(
name=self.name,
msg=self.message,
).replace(' ', ' ')
values to be substituted.
:returns: The modified input_dict
"""
+ input_dict = dict(input_dict)
for (key, value) in input_dict.iteritems():
if isinstance(value, dict):
substitute_placeholders(value, values_dict)
}
},
'suite': Placeholder('suite'),
+ 'suite_branch': Placeholder('suite_branch'),
'tasks': [
{'chef': None},
{'clock.check': None}
assert suite.get_gitbuilder_url('ceph', 'squeeze', 'deb', 'x86_64',
'basic') == ref_url
+ def test_substitute_placeholders(self):
+ input_dict = dict(
+ suite='suite',
+ suite_branch='suite_branch',
+ ceph_branch='ceph_branch',
+ ceph_hash='ceph_hash',
+ teuthology_branch='teuthology_branch',
+ machine_type='machine_type',
+ distro='distro',
+ s3_branch='s3_branch',
+ )
+ output_dict = suite.substitute_placeholders(suite.dict_templ,
+ input_dict)
+ assert output_dict['suite'] == 'suite'
+ assert isinstance(suite.dict_templ['suite'], suite.Placeholder)
+ assert isinstance(
+ suite.dict_templ['overrides']['admin_socket']['branch'],
+ suite.Placeholder)
+
class TestSuiteOnline(object):
def setup(self):
ref_hash = resp.json()['object']['sha']
assert suite.get_hash('ceph') == ref_hash
+ def test_all_master_branches(self):
+ # Don't attempt to send email
+ config.results_email = None
+ job_config = suite.create_initial_config('suite', 'master',
+ 'master', 'master', 'testing',
+ 'basic', 'centos', 'plana')
+ assert ((job_config.branch, job_config.teuthology_branch,
+ job_config.suite_branch) == ('master', 'master', 'master'))
+
def test_config_bogus_kernel_branch(self):
# Don't attempt to send email
config.results_email = None
with raises(suite.ScheduleFailError):
- suite.create_initial_config('s', 'c', 't', 'bogus_kernel_branch',
- 'f', 'd', 'm')
+ suite.create_initial_config('s', None, 'master', 't',
+ 'bogus_kernel_branch', 'f', 'd', 'm')
def test_config_bogus_kernel_flavor(self):
# Don't attempt to send email
config.results_email = None
with raises(suite.ScheduleFailError):
- suite.create_initial_config('s', 'c', 't', 'k',
+ suite.create_initial_config('s', None, 'master', 't', 'k',
'bogus_kernel_flavor', 'd', 'm')
def test_config_bogus_ceph_branch(self):
# Don't attempt to send email
config.results_email = None
with raises(suite.ScheduleFailError):
- suite.create_initial_config('s', 'bogus_ceph_branch', 't', 'k',
- 'f', 'd', 'm')
+ suite.create_initial_config('s', None, 'bogus_ceph_branch', 't',
+ 'k', 'f', 'd', 'm')
+
+ def test_config_bogus_suite_branch(self):
+ # Don't attempt to send email
+ config.results_email = None
+ with raises(suite.ScheduleFailError):
+ suite.create_initial_config('s', 'bogus_suite_branch', 'master',
+ 't', 'k', 'f', 'd', 'm')
+
+ def test_config_bogus_teuthology_branch(self):
+ # Don't attempt to send email
+ config.results_email = None
+ with raises(suite.ScheduleFailError):
+ suite.create_initial_config('s', None, 'master',
+ 'bogus_teuth_branch', 'k', 'f', 'd',
+ 'm')
def test_config_substitution(self):
# Don't attempt to send email
config.results_email = None
job_config = suite.create_initial_config('MY_SUITE', 'master',
- 'master', 'testing', 'basic',
- 'centos', 'plana')
+ 'master', 'master', 'testing',
+ 'basic', 'centos', 'plana')
assert job_config['suite'] == 'MY_SUITE'
def test_config_kernel_section(self):
# Don't attempt to send email
config.results_email = None
job_config = suite.create_initial_config('MY_SUITE', 'master',
- 'master', 'testing', 'basic',
- 'centos', 'plana')
+ 'master', 'master', 'testing',
+ 'basic', 'centos', 'plana')
assert job_config['kernel']['kdb'] is True