Skip to content

Commit

Permalink
Merge pull request #330 from Jimilian/JENKINS_39132
Browse files Browse the repository at this point in the history
[FIX JENKINS-39132] No comments to Gerrit 2.13.1 for Change Merged trigger
  • Loading branch information
rsandell committed Oct 12, 2017
2 parents aac6a0a + 48e0ddc commit c24533f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Expand Up @@ -521,8 +521,8 @@ public String getBuildCompletedCommand(MemoryImprint memoryImprint, TaskListener
command = config.getGerritCmdBuildFailed();
}

Integer verified = 0;
Integer codeReview = 0;
Integer verified = null;
Integer codeReview = null;
Notify notifyLevel = Notify.ALL;
if (memoryImprint.getEvent().isScorable()) {
verified = getMinimumVerifiedValue(memoryImprint, onlyCountBuilt);
Expand Down
Expand Up @@ -60,6 +60,7 @@

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -469,7 +470,7 @@ public void tryGetBuildCompletedCommandSuccessful(String customUrl, String expec
*/
public void tryGetBuildCompletedCommandSuccessfulChangeAbandoned(String customUrl, String expectedBuildsStats)
throws IOException, InterruptedException {
tryGetBuildCompletedCommandSuccessfulEvent(customUrl, expectedBuildsStats, Setup.createChangeAbandoned(), 0, 0);
tryGetBuildCompletedCommandSuccessfulEvent(customUrl, expectedBuildsStats, Setup.createChangeAbandoned(), null, null);
}

/**
Expand All @@ -483,7 +484,7 @@ public void tryGetBuildCompletedCommandSuccessfulChangeAbandoned(String customUr
public void tryGetBuildCompletedCommandSuccessfulChangeMerged(String customUrl, String expectedBuildsStats)
throws IOException, InterruptedException {
tryGetBuildCompletedCommandSuccessfulEvent(customUrl, expectedBuildsStats,
Setup.createChangeMerged(), 0, 0);
Setup.createChangeMerged(), null, null);
}

/**
Expand All @@ -496,7 +497,7 @@ public void tryGetBuildCompletedCommandSuccessfulChangeMerged(String customUrl,
*/
public void tryGetBuildCompletedCommandSuccessfulChangeRestored(String customUrl, String expectedBuildsStats)
throws IOException, InterruptedException {
tryGetBuildCompletedCommandSuccessfulEvent(customUrl, expectedBuildsStats, Setup.createChangeRestored(), 0, 0);
tryGetBuildCompletedCommandSuccessfulEvent(customUrl, expectedBuildsStats, Setup.createChangeRestored(), null, null);
}

/**
Expand All @@ -512,12 +513,11 @@ public void tryGetBuildCompletedCommandSuccessfulChangeRestored(String customUrl
* @throws InterruptedException if so.
*/
public void tryGetBuildCompletedCommandSuccessfulEvent(String customUrl, String expectedBuildsStats,
GerritTriggeredEvent event, int expectedVerifiedVote,
int expectedCodeReviewVote)
GerritTriggeredEvent event, Integer expectedVerifiedVote, Integer expectedCodeReviewVote)
throws IOException, InterruptedException {
tryGetBuildCompletedCommandEventWithResults(customUrl, new String[] {expectedBuildsStats},
new Result[] {Result.SUCCESS}, "'Your friendly butler says OK.",
Setup.createChangeRestored(), 0, 0);
Setup.createChangeRestored(), null, null);
}

/**
Expand All @@ -536,7 +536,7 @@ public void tryGetBuildCompletedCommandSuccessfulEvent(String customUrl, String
*/
public void tryGetBuildCompletedCommandEventWithResults(String customUrl, String[] expectedBuildsStats,
Result[] expectedBuildResults, String expectedMessage, GerritTriggeredEvent event,
int expectedVerifiedVote, int expectedCodeReviewVote)
Integer expectedVerifiedVote, Integer expectedCodeReviewVote)
throws IOException, InterruptedException {

IGerritHudsonTriggerConfig config = Setup.createConfig();
Expand Down Expand Up @@ -587,15 +587,15 @@ public void tryGetBuildCompletedCommandEventWithResults(String customUrl, String
assertThat("Missing BS", result, containsStrings(expectedBuildsStats));
assertThat("Missing CHANGE_ID", result, containsString("CHANGE_ID=Iddaaddaa123456789"));
assertThat("Missing PATCHSET", result, containsString("PATCHSET=1"));
assertThat("Missing VERIFIED", result, containsString("VERIFIED=" + expectedVerifiedVote));
assertThat("Missing CODEREVIEW", result, containsString("CODEREVIEW=" + expectedCodeReviewVote));
assertThat("Missing NOTIFICATION_LEVEL", result, containsString("NOTIFICATION_LEVEL=ALL"));
assertThat("Missing REFSPEC", result, containsString("REFSPEC=" + expectedRefSpec));
assertThat("Missing ENV_BRANCH", result, containsString("ENV_BRANCH=branch"));
assertThat("Missing ENV_CHANGE", result, containsString("ENV_CHANGE=1000"));
assertThat("Missing ENV_REFSPEC", result, containsString("ENV_REFSPEC=" + expectedRefSpec));
assertThat("Missing ENV_CHANGEURL", result, containsString("ENV_CHANGEURL=http://gerrit/1000"));
assertThat("Missing CUSTOM_MESSAGES", result, containsString("CUSTOM_MESSAGE_BUILD_COMPLETED"));
assertThat("Missing VERIFIED", result, containsString("VERIFIED=" + expectedVerifiedVote));
assertThat("Missing CODEREVIEW", result, containsString("CODEREVIEW=" + expectedCodeReviewVote));
}


Expand Down

0 comments on commit c24533f

Please sign in to comment.