diff --git a/bots/notify/src/main/java/org/openjdk/skara/bots/notify/MailingListUpdater.java b/bots/notify/src/main/java/org/openjdk/skara/bots/notify/MailingListUpdater.java index 422685ed7..35bde811b 100644 --- a/bots/notify/src/main/java/org/openjdk/skara/bots/notify/MailingListUpdater.java +++ b/bots/notify/src/main/java/org/openjdk/skara/bots/notify/MailingListUpdater.java @@ -182,6 +182,11 @@ private List filterAndSendPrCommits(HostedRepository repository, List listServer.processIncoming(Duration.ofMillis(1))); + + localRepo.checkout(masterHash, true); + var editHash = CheckableRepository.appendAndCommit(localRepo, "Another line", "23456789: More fixes"); + localRepo.push(editHash, repo.url(), "edit"); + var pr = credentials.createPullRequest(repo, "master", "edit", "RFR: My PR"); + + // PR hasn't been integrated yet, so there should be no mail + TestBotRunner.runPeriodicItems(notifyBot); + assertThrows(RuntimeException.class, () -> listServer.processIncoming(Duration.ofMillis(1))); + + // Simulate an RFR email + var rfr = Email.create(sender, "RFR: My PR", "PR: " + pr.webUrl().toString()) + .recipient(listAddress) + .build(); + mailmanList.post(rfr); + listServer.processIncoming(); + + // And an integration (but it hasn't reached master just yet) + pr.addComment("Pushed as commit " + editHash.hex() + "."); + + // Now push the same commit to another branch + localRepo.push(editHash, repo.url(), "other"); + TestBotRunner.runPeriodicItems(notifyBot); + listServer.processIncoming(); + + // This one should generate a plain integration mail + var conversations = mailmanList.conversations(Duration.ofDays(1)); + assertEquals(2, conversations.size()); + var secondEmail = conversations.get(0).first(); + if (secondEmail.subject().contains("RFR")) { + secondEmail = conversations.get(1).first(); + } + assertEquals("git: test: other: 23456789: More fixes", secondEmail.subject()); + } + } + @Test void testMailingListPR(TestInfo testInfo) throws IOException { try (var listServer = new TestMailmanServer();