Skip to content

Commit

Permalink
add unit test for FileDownload with worker version 2.16
Browse files Browse the repository at this point in the history
Worker 2.16 uses `slavedest` instead `workerdest`.
  • Loading branch information
rutsky committed Jun 20, 2016
1 parent a8a28ab commit 93ef3f1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions master/buildbot/test/unit/test_steps_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,40 @@ def checkCalls(res):

return d

def testBasicWorker2_16(self):
master_file = __file__
self.setupStep(
transfer.FileDownload(
mastersrc=master_file, workerdest=self.destfile),
worker_version={'*': '2.16'})

# A place to store what gets read
read = []

self.expectCommands(
Expect('downloadFile', dict(
slavedest=self.destfile, workdir='wkdir',
blocksize=16384, maxsize=None, mode=None,
reader=ExpectRemoteRef(remotetransfer.FileReader)))
+ Expect.behavior(downloadString(read.append))
+ 0)

self.expectOutcome(
result=SUCCESS,
state_string="downloading to {0}".format(
os.path.basename(self.destfile)))
d = self.runStep()

@d.addCallback
def checkCalls(res):
with open(master_file, "rb") as f:
contents = f.read()
# Only first 1000 bytes trasferred in downloadString() helper
contents = contents[:1000]
self.assertEquals(''.join(read), contents)

return d


class TestStringDownload(steps.BuildStepMixin, unittest.TestCase):

Expand Down

0 comments on commit 93ef3f1

Please sign in to comment.