57
57
autospec=True) as jenkins_mock:
58
58
build_jobs(credentials, root, [])
59
59
jenkins_mock.assert_called_once_with(
60
'http://juju-ci.vapour.ws:8080', 'jrandom', 'password1')
60
'http://localhost:8080', 'jrandom', 'password1')
62
62
def test_build_jobs(self):
63
63
credentials = Credentials('jrandom', 'password1')
75
75
call('compatibility-control',
76
76
{'candidate_path': '1.24.5', 'candidate': '1.24.5',
77
77
'new_to_old': 'true', 'revision_build': '2999',
78
'old_version': '1.18.4', 'client_os': 'ubuntu'}),
78
'old_version': '1.18.4', 'client_os': 'ubuntu'},
79
80
call('compatibility-control-osx',
80
81
{'candidate_path': '1.24.5', 'candidate': '1.24.5',
81
82
'new_to_old': 'true', 'revision_build': '2999',
82
'old_version': '1.18.4', 'client_os': 'osx'}),
83
'old_version': '1.18.4', 'client_os': 'osx'}, token='asdf'),
83
84
call('compatibility-control-windows',
84
85
{'candidate_path': '1.24.5', 'candidate': '1.24.5',
85
86
'new_to_old': 'true', 'revision_build': '2999',
86
'old_version': '1.18.4', 'client_os': 'windows'})]
87
'old_version': '1.18.4', 'client_os': 'windows'},
87
89
with temp_dir() as root:
88
90
write_config(root, 'compatibility-control', 'asdf')
89
91
with patch('schedule_hetero_control.Jenkins',
90
92
autospec=True) as jenkins_mock:
91
93
build_jobs(credentials, root, jobs)
92
94
jenkins_mock.assert_called_once_with(
93
'http://juju-ci.vapour.ws:8080', 'jrandom', 'password1')
95
'http://localhost:8080', 'jrandom', 'password1')
95
97
jenkins_mock.return_value.build_job.call_args_list, calls)
135
137
self.assertItemsEqual(jobs, expected[:6])
136
138
self.assertItemsEqual(jobs_schedule_all, expected)
138
def test_calculate_jobs_ignore_1_26(self):
139
with temp_dir() as root:
140
release_path = os.path.join(root, 'old-juju', '1.20.11')
141
os.makedirs(release_path)
142
candidate_path = os.path.join(root, 'candidate', '1.24')
143
os.makedirs(candidate_path)
144
make_build_var_file(candidate_path, '1.24.3')
145
candidate_path_2 = os.path.join(root, 'candidate', '1.26')
146
os.makedirs(candidate_path_2)
147
make_build_var_file(candidate_path_2, '1.26-aloha1')
148
jobs = list(calculate_jobs(root))
149
expected = self.make_jobs('1.24.3', '1.20.11', '1.24')
150
self.assertItemsEqual(jobs, expected)
152
140
def test_calculate_jobs_osx(self):
153
141
with temp_dir() as root:
154
142
release_path = os.path.join(root, 'old-juju', '1.20.11')
160
148
expected = self.make_jobs('1.24.4', '1.20.11')
161
149
self.assertItemsEqual(jobs, expected)
163
def test_calculate_jobs_candidate_v2(self):
164
with temp_dir() as root:
165
release_path = os.path.join(root, 'old-juju', '1.20.11')
166
os.makedirs(release_path)
167
release_path = os.path.join(root, 'old-juju', '2.0.0')
168
os.makedirs(release_path)
169
candidate_path_2 = os.path.join(root, 'candidate', '2.0.1')
170
os.makedirs(candidate_path_2)
171
make_build_var_file(candidate_path_2, '2.0.1')
172
jobs = list(calculate_jobs(root))
173
expected = self.make_jobs('2.0.1', '2.0.0')
174
self.assertItemsEqual(jobs, expected)
176
def test_calculate_jobs_candiade_v1_and_v2(self):
177
with temp_dir() as root:
178
release_path = os.path.join(root, 'old-juju', '1.20.11')
179
os.makedirs(release_path)
180
release_path = os.path.join(root, 'old-juju', '2.0.0')
181
os.makedirs(release_path)
182
candidate_path = os.path.join(root, 'candidate', '1.24.3')
183
os.makedirs(candidate_path)
184
make_build_var_file(candidate_path, '1.24.3')
185
candidate_path_2 = os.path.join(root, 'candidate', '2.0.1')
186
os.makedirs(candidate_path_2)
187
make_build_var_file(candidate_path_2, '2.0.1')
188
jobs = list(calculate_jobs(root))
189
expected = self.make_jobs('2.0.1', '2.0.0')
190
expected.extend(self.make_jobs('1.24.3', '1.20.11'))
191
self.assertItemsEqual(jobs, expected)
193
def make_jobs(self, candidate, old_version, candidate_path=None):
151
def make_jobs(self, candidate, old_version, candidate_path=False):
195
153
for client_os in ('ubuntu', 'osx', 'windows'):
196
154
for new_to_old in ('false', 'true'):