def test_find_candidates_find_all(self): with temp_dir() as root: a_week_ago = time() - timedelta(days=7, seconds=1).total_seconds() master_path = make_candidate_dir(root, '1.23', modified=a_week_ago) master_path_2 = make_candidate_dir(root, '1.24') self.assertItemsEqual(list(find_candidates(root)), [master_path_2]) self.assertItemsEqual(list(find_candidates(root, find_all=True)), [master_path, master_path_2])
def get_revisions(root_dir): revisions = [] ensure_dir(get_candidates_path(root_dir)) for candidate in find_candidates(root_dir): _, rev = get_candidate_info(candidate) revisions.append(rev) return revisions
def calculate_jobs(root, schedule_all=False): releases = list(get_releases(root)) candidates_path = get_candidates_path(root) for candidate_path in find_candidates(root, schedule_all): parent, candidate = os.path.split(candidate_path) if candidate.startswith('1.26'): # 1.26 was renamed to 2.0 because it is not compatible with 1.x continue if parent != candidates_path: raise ValueError('Wrong path') candidate_version, revision_build = get_candidate_info(candidate_path) for release in releases: # Releases with the same major number must be compatible. if release[:2] != candidate[:2]: continue for client_os in ('ubuntu', 'osx', 'windows'): yield { 'old_version': release, # Client 'candidate': candidate_version, # Server 'new_to_old': 'true', 'candidate_path': candidate, 'client_os': client_os, 'revision_build': revision_build, } yield { 'old_version': release, # Server 'candidate': candidate_version, # Client 'new_to_old': 'false', 'candidate_path': candidate, 'client_os': client_os, 'revision_build': revision_build, }
def main(argv=None): args = parse_args(argv) for candidate_path in find_candidates(args.root_dir, args.all): juju_bin = subprocess.check_output( ['find', candidate_path, '-name', 'juju']).strip() for i in range(args.count): start_job(args.root_dir, args.job, juju_bin, args.user, args.password, i)
def test_find_candidates_artifacts(self): with temp_dir() as root: make_candidate_dir(root, 'master-artifacts') self.assertEqual(list(find_candidates(root)), [])
def test_find_candidates_old_buildvars(self): with temp_dir() as root: a_week_ago = time() - timedelta(days=7, seconds=1).total_seconds() make_candidate_dir(root, 'master', modified=a_week_ago) self.assertEqual(list(find_candidates(root)), [])
def test_find_candidates(self): with temp_dir() as root: master_path = make_candidate_dir(root, 'master') self.assertEqual(list(find_candidates(root)), [master_path])