Skip to content

Commit a41f304

Browse files
authored
Merge pull request #160 from wilzbach/improve-needs-work
Improve 'needs work' check and add a test for it merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
2 parents a247e11 + 0b1da4c commit a41f304

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

source/dlangbot/cron.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ auto detectPRWithPersistentCIFailures(PRTuple t)
146146
case "auto-tester":
147147
case "CyberShadow/DAutoTest":
148148
case "continuous-integration/travis-ci/pr":
149-
case "continuous-integration/travis-ci/jenkins":
149+
case "continuous-integration/jenkins/pr-merge":
150150
case "appveyor":
151151
case "ci/circleci":
152152
return true;

test/cronjob.d

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,28 @@ unittest
165165

166166
testCronDaily(repositories);
167167
}
168+
169+
// test that two or more failing CI trigger "needs work"
170+
unittest
171+
{
172+
setAPIExpectations(
173+
"/github/repos/dlang/phobos/issues?state=open&sort=updated&direction=asc", (ref Json j) {
174+
// only test one pull request
175+
j = Json([j[0]]);
176+
},
177+
"/github/repos/dlang/phobos/pulls/2526",
178+
"/github/repos/dlang/phobos/status/a04acd6a2813fb344d3e47369cf7fd64523ece44", (ref Json j) {
179+
j["statuses"][1]["state"] = "error";
180+
j["statuses"][2]["state"] = "failure";
181+
},
182+
"/github/repos/dlang/phobos/issues/2526/comments", &dontTestStalled,
183+
"/github/repos/dlang/phobos/pulls/2526/comments",
184+
"/github/repos/dlang/phobos/issues/2526/labels",
185+
(scope HTTPServerRequest req, scope HTTPServerResponse res){
186+
assert(req.method == HTTPMethod.PUT);
187+
assert(req.json[].map!(e => e.get!string).equal(["blocked", "needs work"]));
188+
},
189+
);
190+
191+
testCronDaily(repositories);
192+
}

0 commit comments

Comments
 (0)