Skip to content

Commit

Permalink
[FIXED JENKINS-9858] Add unstable or worse result condition
Browse files Browse the repository at this point in the history
Add new result conditioon and assiciated test cases to fix issue 9858
Request new result condition so that unstable or worse can trigger downstream job
  • Loading branch information
cjo9900 authored and kohsuke committed Jul 23, 2011
1 parent 769560b commit 581d03d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Expand Up @@ -10,15 +10,20 @@ boolean isMet(Result result) {
}
},
UNSTABLE("Unstable") {
boolean isMet(Result result) {
return result == Result.UNSTABLE;
}
},
boolean isMet(Result result) {
return result == Result.UNSTABLE;
}
},
UNSTABLE_OR_BETTER("Stable or unstable but not failed") {
boolean isMet(Result result) {
return result.isBetterOrEqualTo(Result.UNSTABLE);
}
},
UNSTABLE_OR_WORSE("Unstable or Failed but not stable") {
boolean isMet(Result result) {
return result.isWorseOrEqualTo(Result.UNSTABLE);
}
},
FAILED("Failed") {
boolean isMet(Result result) {
return result == Result.FAILURE;
Expand Down
Expand Up @@ -52,9 +52,12 @@ public void testTriggerByStableBuild() throws Exception {

schedule(projectA, projectB, ResultCondition.UNSTABLE_OR_BETTER);
assertEquals(2, projectB.getLastBuild().getNumber());

schedule(projectA, projectB, ResultCondition.UNSTABLE);
assertEquals(2, projectB.getLastBuild().getNumber());

schedule(projectA, projectB, ResultCondition.UNSTABLE_OR_WORSE);
assertEquals(2, projectB.getLastBuild().getNumber());
}

public void testTriggerByUnstableBuild() throws Exception {
Expand All @@ -74,6 +77,9 @@ public void testTriggerByUnstableBuild() throws Exception {

schedule(projectA, projectB, ResultCondition.UNSTABLE);
assertEquals(2, projectB.getLastBuild().getNumber());

schedule(projectA, projectB, ResultCondition.UNSTABLE_OR_WORSE);
assertEquals(3, projectB.getLastBuild().getNumber());
}

private void schedule(Project projectA, Project projectB, ResultCondition condition)
Expand Down Expand Up @@ -102,5 +108,8 @@ public void testTriggerByFailedBuild() throws Exception {

schedule(projectA, projectB, ResultCondition.UNSTABLE);
assertEquals(1, projectB.getLastBuild().getNumber());

schedule(projectA, projectB, ResultCondition.UNSTABLE_OR_WORSE);
assertEquals(2, projectB.getLastBuild().getNumber());
}
}

0 comments on commit 581d03d

Please sign in to comment.