Merge lp:~bigkevmcd/offspring/fix-bug-917361 into lp:offspring

Proposed by Kevin McDermott
Status: Merged
Merge reported by: Kevin McDermott
Merged at revision: not available
Proposed branch: lp:~bigkevmcd/offspring/fix-bug-917361
Merge into: lp:offspring
Diff against target: 72 lines (+26/-4)
2 files modified
lib/offspring/slave/slave.py (+3/-2)
lib/offspring/slave/tests/test_slave.py (+23/-2)
To merge this branch: bzr merge lp:~bigkevmcd/offspring/fix-bug-917361
Reviewer Review Type Date Requested Status
Guilherme Salgado Approve
CE Infrastructure Pending
Review via email: mp+89959@code.launchpad.net

Description of the change

This adds tests and a fix for this bug.

To post a comment you must log in.
Revision history for this message
Kevin McDermott (bigkevmcd) wrote :

Ideally, we'd make the master call a No-Op version of the slave to avoid these issues, but this would need to be asynchronous (and out-of process?)

Revision history for this message
Guilherme Salgado (salgado) wrote :

Thanks a lot for taking care of this, Kevin. It looks good to me.

 review approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/offspring/slave/slave.py'
2--- lib/offspring/slave/slave.py 2011-12-09 17:07:43 +0000
3+++ lib/offspring/slave/slave.py 2012-01-24 17:52:23 +0000
4@@ -132,13 +132,14 @@
5 self, addr, requestHandler, logRequests, allow_none, encoding,
6 request_timeout)
7
8- def api_startBuild(self, projectName, configBranchURL):
9+ def api_startBuild(self, projectName, configBranchURL, lpUser=None,
10+ lpSSHKey=None):
11 """
12 Start building the project on the LexbuilderSlave.
13 """
14 if self.slave.currentBuildIsActive():
15 return LexbuilderSlaveServer.REQUEST_ERROR
16- self.slave.startBuild(projectName, configBranchURL)
17+ self.slave.startBuild(projectName, configBranchURL, lpUser, lpSSHKey)
18 return LexbuilderSlaveServer.REQUEST_OKAY
19
20 def api_stopBuild(self):
21
22=== modified file 'lib/offspring/slave/tests/test_slave.py'
23--- lib/offspring/slave/tests/test_slave.py 2012-01-11 08:08:10 +0000
24+++ lib/offspring/slave/tests/test_slave.py 2012-01-24 17:52:23 +0000
25@@ -193,7 +193,6 @@
26 to be valid for this test.
27
28 """
29-
30 # Set up a fake build process (starts off in STATE_ACTIVE)
31 self.slave.currentBuild = FakeProjectBuildProcess()
32
33@@ -352,9 +351,12 @@
34 self.state = state
35 self.config = config
36
37- def startBuild(self, project_name, config_url):
38+ def startBuild(self, project_name, config_url, lp_user=None,
39+ lp_sshkey=None):
40 self.project_name = project_name
41 self.config_url = config_url
42+ self.lp_user = lp_user
43+ self.private_key = lp_sshkey
44 self.started = True
45
46 def stopBuild(self):
47@@ -456,6 +458,25 @@
48 self.assertFalse(self.fake_slave.project_name)
49 self.assertFalse(self.fake_slave.config_url)
50
51+ def test_api_start_build_with_private_project_details(self):
52+ """
53+ If the lpSSHKey and lpUser are supplied, then these should be passed to
54+ the underlying SlaveServer.
55+ """
56+ self.fake_slave.currentBuild = FakeBuild()
57+ slave_server = self.create_slave_server()
58+
59+ response = slave_server.api_startBuild("testing",
60+ "http://example.com/",
61+ "testing",
62+ "private_key")
63+ self.assertEqual(LexbuilderSlaveServer.REQUEST_OKAY, response)
64+ self.assertEqual("testing", self.fake_slave.project_name)
65+ self.assertEqual("http://example.com/", self.fake_slave.config_url)
66+ self.assertEqual("testing", self.fake_slave.lp_user)
67+ self.assertEqual("private_key", self.fake_slave.private_key)
68+ self.assertTrue(self.fake_slave.started)
69+
70 def test_api_stop_build(self):
71 """
72 If the SlaveServer has an active build, api_stopBuild should end the

Subscribers

People subscribed via source and target branches