Merge lp:~mrazik/jenkins-launchpad-plugin/lp1154185 into lp:~private-ps-quality-team/jenkins-launchpad-plugin/trunk

Proposed by Martin Mrazik
Status: Merged
Approved by: Martin Mrazik
Approved revision: 96
Merged at revision: 94
Proposed branch: lp:~mrazik/jenkins-launchpad-plugin/lp1154185
Merge into: lp:~private-ps-quality-team/jenkins-launchpad-plugin/trunk
Diff against target: 87 lines (+46/-5)
2 files modified
launchpad.py (+13/-3)
tests/test_launchpadTrigger.py (+33/-2)
To merge this branch: bzr merge lp:~mrazik/jenkins-launchpad-plugin/lp1154185
Reviewer Review Type Date Requested Status
Francis Ginther Approve
PS Jenkins bot continuous-integration Approve
Michael Zanetti (community) Approve
Review via email: mp+154372@code.launchpad.net

Commit message

In case the build result is STABLE or SUCCESS provide a link directly to the build instead of console output. The build main page has the summary of failed tests which is what you are interested in, in these two cases.
If the build result is FAILURE then keep the current functionality and link to console output as it is most likely a build error (merge error, etc).

Description of the change

In case the build result is STABLE or SUCCESS provide a link directly to the build instead of console output. The build main page has the summary of failed tests which is what you are interested in, in these two cases.
If the build result is FAILURE then keep the current functionality and link to console output as it is most likely a build error (merge error, etc).

To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) wrote :

looks good. just noticed a small inconsistency with chopping the trailing /. Its removed on console links, but not on the others..

95. By Martin Mrazik

fixed IP addresses in the test to resemble real ones and striped a trailing "/" in urls

96. By Martin Mrazik

fixed a comment

Revision history for this message
Michael Zanetti (mzanetti) wrote :

lgtm

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Approve.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launchpad.py'
2--- launchpad.py 2013-03-13 14:39:28 +0000
3+++ launchpad.py 2013-03-20 14:06:21 +0000
4@@ -353,15 +353,25 @@
5 vote='Disapprove', subject=message,
6 content=message)
7
8+ def _get_result_line(self, result, url):
9+ url = url.rstrip('/')
10+ if result == 'SUCCESS' or result == 'UNSTABLE':
11+ if url.endswith('console'):
12+ # strip "/console"
13+ url = url[:-8]
14+ return "\n {result}: {output}".format(
15+ result=result,
16+ output=url)
17+
18 def get_executed_test_runs_message(self, url):
19 ret = "\nExecuted test runs:"
20 jenkins = self._get_json_jenkins(url)
21 builds = jenkinsutils.get_executed_builds(jenkins, url)
22 coverity_artifacts = []
23 for build in builds:
24- ret += "\n {result}: {output}".format(
25- result=build['result'],
26- output=jenkinsutils.hide_jenkins_url(build['output']))
27+ ret += self._get_result_line(
28+ build['result'],
29+ jenkinsutils.hide_jenkins_url(build['output']))
30 if build['output'].endswith('console'):
31 build_url = build['output'][:-len('console')]
32 artifacts = jenkinsutils.get_coverity_artifacts(jenkins,
33
34=== modified file 'tests/test_launchpadTrigger.py'
35--- tests/test_launchpadTrigger.py 2013-03-13 15:08:30 +0000
36+++ tests/test_launchpadTrigger.py 2013-03-20 14:06:21 +0000
37@@ -441,6 +441,37 @@
38 self.launchpadTrigger = launchpad.LaunchpadTrigger()
39
40
41+class TestGetResultLine(TestWithScenarios, TestLaunchpadTrigger):
42+ scenarios = [
43+ ('success',
44+ {'result': 'SUCCESS',
45+ 'url': 'http://10.0.0.1:8080/job/my-job/13/console',
46+ 'expected': "\n SUCCESS: http://10.0.0.1:8080/job/my-job/13"}),
47+ ('success_with_slash',
48+ {'result': 'SUCCESS',
49+ 'url': 'http://10.0.0.1:8080/job/my-job/13/console/',
50+ 'expected': "\n SUCCESS: http://10.0.0.1:8080/job/my-job/13"}),
51+ ('unstable',
52+ {'result': 'UNSTABLE',
53+ 'url': 'http://10.0.0.1:8080/job/my-job/13/console',
54+ 'expected': "\n UNSTABLE: http://10.0.0.1:8080/job/my-job/13"}),
55+ ('failed',
56+ {'result': 'FAILURE',
57+ 'url': 'http://10.0.0.1:8080/job/my-job/13/console',
58+ 'expected':
59+ "\n FAILURE: http://10.0.0.1:8080/job/my-job/13/console"}),
60+ ('none',
61+ {'result': None,
62+ 'url': 'http://10.0.0.1:8080/job/my-job/13/console',
63+ 'expected':
64+ "\n None: http://10.0.0.1:8080/job/my-job/13/console"}),
65+ ]
66+
67+ def test_get_result_line(self):
68+ result = self.launchpadTrigger._get_result_line(self.result, self.url)
69+ self.assertEqual(result, self.expected)
70+
71+
72 class TestGetCommitMessage(TestWithScenarios, TestLaunchpadTrigger):
73 scenarios = [
74 ('no_commit_message',
75@@ -701,10 +732,10 @@
76 """distribution=raring,flavor=amd64/3/console
77 FAILURE: http://jenkins:8080/job/job-multiconfig/./""" +
78 """distribution=raring,flavor=i386/3/console
79- SUCCESS: http://jenkins:8080/job/job-freestyle/7/console
80+ SUCCESS: http://jenkins:8080/job/job-freestyle/7
81 deb: http://jenkins:8080/job/job-freestyle/7/artifact/work/""" +
82 """output/*zip*/output.zip
83- UNSTABLE: http://jenkins:8080/job/freestyle-downstream/12/console
84+ UNSTABLE: http://jenkins:8080/job/freestyle-downstream/12
85 Coverity artifacts:
86 http://jenkins:8080/job/job-multiconfig/./distribution=""" +
87 """raring,flavor=amd64/3/artifact/results/coverity/CID_10895.html

Subscribers

People subscribed via source and target branches

to all changes: