Merge lp:~sseman/juju-ci-tools/schedule-all-oses into lp:juju-ci-tools

Proposed by Seman
Status: Merged
Merged at revision: 1084
Proposed branch: lp:~sseman/juju-ci-tools/schedule-all-oses
Merge into: lp:juju-ci-tools
Diff against target: 204 lines (+48/-93)
2 files modified
schedule_hetero_control.py (+22/-26)
test_schedule_hetero_control.py (+26/-67)
To merge this branch: bzr merge lp:~sseman/juju-ci-tools/schedule-all-oses
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+270103@code.launchpad.net

Description of the change

This branch adds scheduling the compatibility-control job for all of the OSes (Ubuntu, OS X, Windows). It also adds "revision_build" parameter when building the job. The revision build number will be used to get the OS X and Windows candidate Juju from the S3.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'schedule_hetero_control.py'
2--- schedule_hetero_control.py 2015-08-27 21:40:15 +0000
3+++ schedule_hetero_control.py 2015-09-03 19:19:21 +0000
4@@ -40,9 +40,11 @@
5 yield entry
6
7
8-def get_candidate_version(candidate_path):
9+def get_candidate_info(candidate_path):
10+ """ Return candidate version and revision build number. """
11 with open(os.path.join(candidate_path, 'buildvars.json')) as fp:
12- return json.load(fp)['version']
13+ build_vars = json.load(fp)
14+ return build_vars['version'], build_vars['revision_build']
15
16
17 def calculate_jobs(root, schedule_all=False):
18@@ -52,31 +54,25 @@
19 parent, candidate = os.path.split(candidate_path)
20 if parent != candidates_path:
21 raise ValueError('Wrong path')
22- candidate_version = get_candidate_version(candidate_path)
23+ candidate_version, revision_build = get_candidate_info(candidate_path)
24 for release in releases:
25- if is_osx_client(candidate) is not is_osx_client(release):
26- continue
27- client_os = 'ubuntu'
28- if is_osx_client(release):
29- client_os = 'osx'
30- yield {
31- 'old_version': release, # Client
32- 'candidate': candidate_version, # Server
33- 'new_to_old': 'true',
34- 'candidate_path': candidate,
35- 'client_os': client_os,
36- }
37- yield {
38- 'old_version': release, # Server
39- 'candidate': candidate_version, # Client
40- 'new_to_old': 'false',
41- 'candidate_path': candidate,
42- 'client_os': client_os,
43- }
44-
45-
46-def is_osx_client(path):
47- return path.endswith('-osx')
48+ for client_os in ('ubuntu', 'osx', 'windows'):
49+ yield {
50+ 'old_version': release, # Client
51+ 'candidate': candidate_version, # Server
52+ 'new_to_old': 'true',
53+ 'candidate_path': candidate,
54+ 'client_os': client_os,
55+ 'revision_build': revision_build,
56+ }
57+ yield {
58+ 'old_version': release, # Server
59+ 'candidate': candidate_version, # Client
60+ 'new_to_old': 'false',
61+ 'candidate_path': candidate,
62+ 'client_os': client_os,
63+ 'revision_build': revision_build,
64+ }
65
66
67 def build_jobs(credentials, root, jobs):
68
69=== modified file 'test_schedule_hetero_control.py'
70--- test_schedule_hetero_control.py 2015-08-27 21:40:15 +0000
71+++ test_schedule_hetero_control.py 2015-09-03 19:19:21 +0000
72@@ -15,7 +15,7 @@
73 build_jobs,
74 calculate_jobs,
75 get_args,
76- get_candidate_version,
77+ get_candidate_info,
78 get_releases,
79 )
80 from utility import temp_dir
81@@ -56,12 +56,13 @@
82 'http://localhost:8080', 'jrandom', 'password1')
83
84
85-class TestGetCandidateVersion(TestCase):
86- def test_get_candidate_version(self):
87+class TestGetCandidateInfo(TestCase):
88+ def test_get_candidate_info(self):
89 with temp_dir() as dir_path:
90 make_build_var_file(dir_path, version='1.24.3')
91- version = get_candidate_version(dir_path)
92+ version, revision = get_candidate_info(dir_path)
93 self.assertEqual(version, '1.24.3')
94+ self.assertEqual(revision, '2870')
95
96
97 class CalculateJobs(TestCase):
98@@ -73,18 +74,7 @@
99 os.makedirs(candidate_path)
100 make_build_var_file(candidate_path, version='1.24.3')
101 jobs = list(calculate_jobs(root))
102- expected = [{'new_to_old': 'true',
103- 'old_version': '1.20.11',
104- 'candidate': '1.24.3',
105- 'candidate_path': '1.24',
106- 'client_os': 'ubuntu',
107- },
108- {'new_to_old': 'false',
109- 'old_version': '1.20.11',
110- 'candidate': '1.24.3',
111- 'candidate_path': '1.24',
112- 'client_os': 'ubuntu'}]
113-
114+ expected = self.make_jobs('1.24.3', '1.20.11', '1.24')
115 self.assertItemsEqual(jobs, expected)
116
117 def test_calculate_jobs_schedule_all(self):
118@@ -101,66 +91,35 @@
119 os.utime(buildvars_path, (time(), a_week_ago))
120 jobs = list(calculate_jobs(root, schedule_all=False))
121 jobs_schedule_all = list(calculate_jobs(root, schedule_all=True))
122- expected = [{'new_to_old': 'true',
123- 'client_os': 'ubuntu',
124- 'old_version': '1.20.11',
125- 'candidate': '1.23.3',
126- 'candidate_path': '1.23'},
127- {'new_to_old': 'false',
128- 'client_os': 'ubuntu',
129- 'old_version': '1.20.11',
130- 'candidate': '1.23.3',
131- 'candidate_path': '1.23'},
132- {'new_to_old': 'true',
133- 'client_os': 'ubuntu',
134- 'old_version': '1.20.11',
135- 'candidate': '1.24.3',
136- 'candidate_path': '1.24'},
137- {'new_to_old': 'false',
138- 'client_os': 'ubuntu',
139- 'old_version': '1.20.11',
140- 'candidate': '1.24.3',
141- 'candidate_path': '1.24'}]
142- self.assertItemsEqual(jobs, expected[2:])
143+ expected = self.make_jobs('1.24.3', '1.20.11', '1.24')
144+ expected.extend(self.make_jobs('1.23.3', '1.20.11', '1.23'))
145+ self.assertItemsEqual(jobs, expected[:6])
146 self.assertItemsEqual(jobs_schedule_all, expected)
147
148 def test_calculate_jobs_osx(self):
149 with temp_dir() as root:
150 release_path = os.path.join(root, 'old-juju', '1.20.11')
151 os.makedirs(release_path)
152- release_path = os.path.join(root, 'old-juju', '1.20.11-osx')
153- os.makedirs(release_path)
154-
155- candidate_path_1 = os.path.join(root, 'candidate', '1.24.4')
156- os.makedirs(candidate_path_1)
157- make_build_var_file(candidate_path_1, '1.24.4')
158-
159- candidate_path_2 = os.path.join(root, 'candidate', '1.24.4-osx')
160- os.makedirs(candidate_path_2)
161- make_build_var_file(candidate_path_2, '1.24.4')
162+ candidate_path = os.path.join(root, 'candidate', '1.24.4')
163+ os.makedirs(candidate_path)
164+ make_build_var_file(candidate_path, '1.24.4')
165 jobs = list(calculate_jobs(root, schedule_all=False))
166- expected = [{'candidate': '1.24.4',
167- 'candidate_path': '1.24.4',
168- 'client_os': 'ubuntu',
169- 'new_to_old': 'true',
170- 'old_version': '1.20.11'},
171- {'candidate': '1.24.4',
172- 'candidate_path': '1.24.4',
173- 'client_os': 'ubuntu',
174- 'new_to_old': 'false',
175- 'old_version': '1.20.11'},
176- {'candidate': '1.24.4',
177- 'candidate_path': '1.24.4-osx',
178- 'client_os': 'osx',
179- 'new_to_old': 'true',
180- 'old_version': '1.20.11-osx'},
181- {'candidate': '1.24.4',
182- 'candidate_path': '1.24.4-osx',
183- 'client_os': 'osx',
184- 'new_to_old': 'false',
185- 'old_version': '1.20.11-osx'}]
186+ expected = self.make_jobs('1.24.4', '1.20.11')
187 self.assertItemsEqual(jobs, expected)
188
189+ def make_jobs(self, candidate, old_version, candidate_path=False):
190+ jobs = []
191+ for client_os in ('ubuntu', 'osx', 'windows'):
192+ for new_to_old in ('false', 'true'):
193+ jobs.append({
194+ 'candidate': candidate,
195+ 'candidate_path': candidate_path or candidate,
196+ 'client_os': client_os,
197+ 'new_to_old': new_to_old,
198+ 'old_version': old_version,
199+ 'revision_build': '2870'})
200+ return jobs
201+
202
203 def make_build_var_file(dir_path, version):
204 build_vars = {"version": version, "revision_build": "2870"}

Subscribers

People subscribed via source and target branches