Skip to content

Commit

Permalink
Merge pull request #2406 from Cray/stash-reporter
Browse files Browse the repository at this point in the history
Fix Stash reporter
  • Loading branch information
tardyp committed Sep 15, 2016
2 parents 819e1f2 + 45629b5 commit 8a72ae5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions master/buildbot/reporters/stash.py
Expand Up @@ -48,7 +48,7 @@ def send(self, build):
body = {'state': status, 'key': build[
'builder']['name'], 'url': build['url']}
stash_uri = self.base_url + sha
response = yield self.session.post(stash_uri, body, auth=self.auth)
if response.status_code != 200:
response = yield self.session.post(stash_uri, json=body, auth=self.auth)
if response.status_code != 204:
log.msg("%s: unable to upload stash status: %s" %
(response.status, response.content))
(response.status_code, response.content))
15 changes: 9 additions & 6 deletions master/buildbot/test/unit/test_reporter_stash.py
Expand Up @@ -64,11 +64,14 @@ def test_basic(self):
self.assertEqual(
self.sp.session.post.mock_calls,
[call(u'serv/rest/build-status/1.0/commits/d34db33fd43db33f',
{'url': 'http://localhost:8080/#builders/79/builds/0',
'state': 'INPROGRESS', 'key': u'Builder0'}, auth=('username', 'passwd')),
json={'url': 'http://localhost:8080/#builders/79/builds/0',
'state': 'INPROGRESS', 'key': u'Builder0'},
auth=('username', 'passwd')),
call(u'serv/rest/build-status/1.0/commits/d34db33fd43db33f',
{'url': 'http://localhost:8080/#builders/79/builds/0',
'state': 'SUCCESSFUL', 'key': u'Builder0'}, auth=('username', 'passwd')),
json={'url': 'http://localhost:8080/#builders/79/builds/0',
'state': 'SUCCESSFUL', 'key': u'Builder0'},
auth=('username', 'passwd')),
call(u'serv/rest/build-status/1.0/commits/d34db33fd43db33f',
{'url': 'http://localhost:8080/#builders/79/builds/0',
'state': 'FAILED', 'key': u'Builder0'}, auth=('username', 'passwd'))])
json={'url': 'http://localhost:8080/#builders/79/builds/0',
'state': 'FAILED', 'key': u'Builder0'},
auth=('username', 'passwd'))])

0 comments on commit 8a72ae5

Please sign in to comment.