mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 03:30:46 +02: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:
parent
06b0887c51
commit
e31f0cb9ba
2 changed files with 10 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue