mirror of
https://github.com/google/nomulus
synced 2026-04-24 02:00:50 +00:00
Don't send email notification when 0 uploads were attempted (#1058)
* Don't send email notification when 0 uploads were attempted
This commit is contained in:
@@ -278,9 +278,15 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||
}
|
||||
|
||||
private void emailUploadResults(ImmutableMap<String, Boolean> reportSummary) {
|
||||
String subject = String.format(
|
||||
"ICANN Monthly report upload summary: %d/%d succeeded",
|
||||
reportSummary.values().stream().filter((b) -> b).count(), reportSummary.size());
|
||||
if (reportSummary.size() == 0) {
|
||||
logger.atInfo().log("No uploads were attempted today; skipping notification email.");
|
||||
return;
|
||||
}
|
||||
String subject =
|
||||
String.format(
|
||||
"ICANN Monthly report upload summary: %d/%d succeeded",
|
||||
// This filter() does in fact do something: It counts only the trues.
|
||||
reportSummary.values().stream().filter((b) -> b).count(), reportSummary.size());
|
||||
String body =
|
||||
String.format(
|
||||
"Report Filename - Upload status:\n%s",
|
||||
|
||||
@@ -210,13 +210,7 @@ class IcannReportingUploadActionTest {
|
||||
action.run();
|
||||
tm().clearSessionCache();
|
||||
verifyNoMoreInteractions(mockReporter);
|
||||
verify(emailService)
|
||||
.sendEmail(
|
||||
EmailMessage.create(
|
||||
"ICANN Monthly report upload summary: 0/0 succeeded",
|
||||
"Report Filename - Upload status:\n",
|
||||
new InternetAddress("recipient@example.com"),
|
||||
new InternetAddress("sender@example.com")));
|
||||
verifyNoMoreInteractions(emailService);
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
|
||||
Reference in New Issue
Block a user