From 3b5d041d03f88b3f7a6440cb41b2b98f8dd1018f Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Fri, 6 Sep 2024 20:43:28 +0200 Subject: [PATCH] allow more time for timetout Signed-off-by: Ceki Gulcu --- .../classic/blackbox/net/SMTPAppender_GreenTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/net/SMTPAppender_GreenTest.java b/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/net/SMTPAppender_GreenTest.java index d514f0dc9a..da6f6f3a1d 100644 --- a/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/net/SMTPAppender_GreenTest.java +++ b/logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/net/SMTPAppender_GreenTest.java @@ -67,7 +67,8 @@ public class SMTPAppender_GreenTest { static final boolean SYNCHRONOUS = false; static final boolean ASYNCHRONOUS = true; - + static int TIMEOUT = 3000; + int port = RandomUtil.getRandomServerPort(); // GreenMail cannot be static. As a shared server induces race conditions GreenMail greenMailServer; @@ -160,10 +161,12 @@ private MimeMultipart verifyAndExtractMimeMultipart(String subject) return (MimeMultipart) mm.getContent(); } + + void waitUntilEmailIsSent() throws InterruptedException { ExecutorService es = loggerContext.getExecutorService(); es.shutdown(); - boolean terminated = es.awaitTermination(1000, TimeUnit.MILLISECONDS); + boolean terminated = es.awaitTermination(TIMEOUT, TimeUnit.MILLISECONDS); // this assertion may be needlessly strict if(!terminated) { fail("executor elapsed before accorded delay");