Merge lp:~sseman/juju-ci-tools/client-server-concurrent into lp:juju-ci-tools

Proposed by Seman
Status: Merged
Merged at revision: 1114
Proposed branch: lp:~sseman/juju-ci-tools/client-server-concurrent
Merge into: lp:juju-ci-tools
Diff against target: 93 lines (+47/-5)
2 files modified
schedule_hetero_control.py (+4/-1)
tests/test_schedule_hetero_control.py (+43/-4)
To merge this branch: bzr merge lp:~sseman/juju-ci-tools/client-server-concurrent
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+272460@code.launchpad.net

Description of the change

This branch splits scheduling the client-server tests into three jobs: compatibility-control, compatibility-control-osx and compatibility-control-windows.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

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-09-03 19:04:07 +0000
3+++ schedule_hetero_control.py 2015-09-25 18:22:31 +0000
4@@ -78,8 +78,11 @@
5 def build_jobs(credentials, root, jobs):
6 jenkins = Jenkins('http://localhost:8080', *credentials)
7 token = get_auth_token(root, 'compatibility-control')
8+ os_str = {"ubuntu": "", "osx": "-osx", "windows": "-windows"}
9 for job in jobs:
10- jenkins.build_job('compatibility-control', job, token=token)
11+ jenkins.build_job(
12+ 'compatibility-control{}'.format(os_str[job['client_os']]), job,
13+ token=token)
14
15
16 def main():
17
18=== modified file 'tests/test_schedule_hetero_control.py'
19--- tests/test_schedule_hetero_control.py 2015-09-22 22:41:12 +0000
20+++ tests/test_schedule_hetero_control.py 2015-09-25 18:22:31 +0000
21@@ -1,12 +1,17 @@
22 from __future__ import print_function
23
24+__metaclass__ = type
25+
26 from datetime import timedelta
27 import json
28 import os
29 from time import time
30 from unittest import TestCase
31
32-from mock import patch
33+from mock import (
34+ call,
35+ patch,
36+)
37
38 from jujuci import Credentials
39 from schedule_hetero_control import (
40@@ -20,9 +25,6 @@
41 from test_utility import write_config
42
43
44-__metaclass__ = type
45-
46-
47 class TestScheduleHeteroControl(TestCase):
48
49 def test_get_args_credentials(self):
50@@ -56,6 +58,43 @@
51 jenkins_mock.assert_called_once_with(
52 'http://localhost:8080', 'jrandom', 'password1')
53
54+ def test_build_jobs(self):
55+ credentials = Credentials('jrandom', 'password1')
56+ jobs = []
57+ for os_str in ('ubuntu', 'osx', 'windows'):
58+ jobs.append({
59+ 'old_version': "1.18.4",
60+ 'candidate': "1.24.5",
61+ 'new_to_old': 'true',
62+ 'candidate_path': "1.24.5",
63+ 'client_os': os_str,
64+ 'revision_build': "2999"
65+ })
66+ calls = [
67+ call('compatibility-control',
68+ {'candidate_path': '1.24.5', 'candidate': '1.24.5',
69+ 'new_to_old': 'true', 'revision_build': '2999',
70+ 'old_version': '1.18.4', 'client_os': 'ubuntu'},
71+ token='asdf'),
72+ call('compatibility-control-osx',
73+ {'candidate_path': '1.24.5', 'candidate': '1.24.5',
74+ 'new_to_old': 'true', 'revision_build': '2999',
75+ 'old_version': '1.18.4', 'client_os': 'osx'}, token='asdf'),
76+ call('compatibility-control-windows',
77+ {'candidate_path': '1.24.5', 'candidate': '1.24.5',
78+ 'new_to_old': 'true', 'revision_build': '2999',
79+ 'old_version': '1.18.4', 'client_os': 'windows'},
80+ token='asdf')]
81+ with temp_dir() as root:
82+ write_config(root, 'compatibility-control', 'asdf')
83+ with patch('schedule_hetero_control.Jenkins',
84+ autospec=True) as jenkins_mock:
85+ build_jobs(credentials, root, jobs)
86+ jenkins_mock.assert_called_once_with(
87+ 'http://localhost:8080', 'jrandom', 'password1')
88+ self.assertEqual(
89+ jenkins_mock.return_value.build_job.call_args_list, calls)
90+
91
92 class TestGetCandidateInfo(TestCase):
93 def test_get_candidate_info(self):

Subscribers

People subscribed via source and target branches