Skip to content

Commit 9b198f3

Browse files
committed
Add automated test of JENKINS-39044
If the ReverseTrigger threshold were null, a null pointer exception would be thrown. The config round trip operation resets a null threshold to SUCCESS, so this test reaches inside the job definition and changes the threshold directly. Testing done: * Confirmed that the modified automated test fails when the change to ReverseTrigger is removed. * Confirmed that the modified automated test passes when the change to ReverseTrigger is included.
1 parent ab0cd10 commit 9b198f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/src/test/java/jenkins/triggers/ReverseBuildTriggerTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void upstreamProjectSecurity() throws Exception {
189189
assertEquals(3, downstream.getLastBuild().number);
190190
}
191191

192-
@Issue("JENKINS-29876")
192+
@Issue({"JENKINS-29876", "JENKINS-39044"})
193193
@Test
194194
void nullJobInTriggerNotCausesNPE() throws Exception {
195195
final FreeStyleProject upstreamJob = r.createFreeStyleProject("upstream");
@@ -208,6 +208,11 @@ void nullJobInTriggerNotCausesNPE() throws Exception {
208208
r.configRoundtrip(downstreamJob2);
209209

210210
r.jenkins.rebuildDependencyGraph();
211+
212+
// JENKINS-39044 - NPE if trigger threshold is null
213+
ReverseBuildTrigger trigger = downstreamJob2.getTrigger(ReverseBuildTrigger.class);
214+
trigger.setThreshold(null);
215+
211216
final FreeStyleBuild build = r.buildAndAssertSuccess(upstreamJob);
212217
r.waitUntilNoActivity();
213218

0 commit comments

Comments
 (0)