diff --git a/verigreen-collector-impl/src/main/java/com/verigreen/collector/common/EmailSender.java b/verigreen-collector-impl/src/main/java/com/verigreen/collector/common/EmailSender.java index 0d150c0..f796dac 100644 --- a/verigreen-collector-impl/src/main/java/com/verigreen/collector/common/EmailSender.java +++ b/verigreen-collector-impl/src/main/java/com/verigreen/collector/common/EmailSender.java @@ -122,8 +122,9 @@ public void notifyCommiter( if(result.equals(VerificationStatus.MERGE_FAILED)) { status.append(String.format("Merge failed between commits: %s and %s",parentCommitId.substring(0, 7),commitId.substring(0, 7))); - } - else + } else if(parentCommitId != null) { + status.append(String.format("New process Id:vg_%s", parentCommitId)); + } else { status.append(String.format("Commit Id:%s", commitId.substring(0, 7))); } diff --git a/verigreen-collector-impl/src/main/java/com/verigreen/collector/decision/OnFailureHandler.java b/verigreen-collector-impl/src/main/java/com/verigreen/collector/decision/OnFailureHandler.java index 4368779..6b4e845 100644 --- a/verigreen-collector-impl/src/main/java/com/verigreen/collector/decision/OnFailureHandler.java +++ b/verigreen-collector-impl/src/main/java/com/verigreen/collector/decision/OnFailureHandler.java @@ -48,7 +48,19 @@ protected void doHandle() { _commitItem.getParent().getBranchDescriptor().getCommitId(), _commitItem.getMergedBranchName() ); - } + } else if(!_commitItem.getChildCommit().isEmpty()){ + CollectorApi.getEmailSender().notifyCommiter( + _commitItem.getBranchDescriptor().getCommitId(), + _commitItem.getStatus(), + _commitItem.getBuildUrl(), + "Verigreen Status - Failure", + EmailSender.getFailedSignature(), + _commitItem.getBranchDescriptor().getCommitter(), + _commitItem.getBranchDescriptor().getProtectedBranch(), + _commitItem.getChildCommit(), + _commitItem.getMergedBranchName() + ); + } else { CollectorApi.getEmailSender().notifyCommiter( _commitItem.getBranchDescriptor().getCommitId(), diff --git a/verigreen-collector-system-tests/utest/com/verigreen/collector/systemtest/TestCollectorE2EGreenPath.java b/verigreen-collector-system-tests/utest/com/verigreen/collector/systemtest/TestCollectorE2EGreenPath.java index e2fc977..1eccb65 100644 --- a/verigreen-collector-system-tests/utest/com/verigreen/collector/systemtest/TestCollectorE2EGreenPath.java +++ b/verigreen-collector-system-tests/utest/com/verigreen/collector/systemtest/TestCollectorE2EGreenPath.java @@ -1375,4 +1375,81 @@ public void testPermittedUsersChangesInRT() throws IOException, InterruptedExcep Assert.assertTrue(ex instanceof RestClientException); } } + + + @Test + public void testScenario() throws IOException, InterruptedException { + String destinationFolderForNewFile = DEFAULT_COMMIT_FOLDER; + + String masterBranchCurrentSHA1 = + ((JGitOperator) _sourceControlOperator).getRef( + getBranchRefsRemotesFullName(_masterBranch)).getObjectId().getName(); + + String commiterName = generateUserName(); + String commiterEmail = generateEmailAddress(); + String content = getContent("test"); + String[] branch = generateBranchNames(1); + + setProtectedBranch(_masterBranch); + checkoutExistingBranch(_masterBranch); + + String commitId = + commitAndPush( + destinationFolderForNewFile, + commiterName, + commiterEmail, + content, + true, + _masterBranch); + + String shortCommitId = processCommitId(commitId, commiterName); + checkSuccessfulyProccesedCommitThatShouldPass( + VerigreenUtils.getVerigreenBranchName(shortCommitId), + _masterBranch, + _timeoutForTestInMilis, + commitId, + commiterName, + commiterEmail, + content, + true); + + ((JGitOperator) _sourceControlOperator).reset(masterBranchCurrentSHA1); + createAndPushBranches(branch); + checkoutExistingBranch(branch[0]); + + commitAndPush( + destinationFolderForNewFile, + commiterName, + commiterEmail, + content, + true, + true, + branch[0]); + + checkoutExistingBranch(_masterBranch); + _sourceControlOperator.merge(_masterBranch,_masterBranch); + _sourceControlOperator.merge(_masterBranch, branch[0]); + + String commitId3 = + commitAndPush( + destinationFolderForNewFile, + commiterName, + commiterEmail, + content, + true, + _masterBranch); + + String shortCommitId3 = processCommitId(commitId3, commiterName); + + checkSuccessfulyProccesedCommitThatShouldFail( + VerigreenUtils.getVerigreenBranchName(shortCommitId3), + _masterBranch, + _timeoutForTestInMilis, + commitId3, + commiterName, + commiterEmail, + content, + VerificationStatus.GIT_FAILURE, + true); + } } \ No newline at end of file