From cc8db8310b7dbe154cf4758d729ec59a29fc1ded Mon Sep 17 00:00:00 2001 From: jrhee17 Date: Fri, 9 Aug 2024 11:35:49 +0900 Subject: [PATCH] handle flaky --- .../linecorp/armeria/client/ContextCancellationTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/com/linecorp/armeria/client/ContextCancellationTest.java b/core/src/test/java/com/linecorp/armeria/client/ContextCancellationTest.java index 4424599e7ac..37c2859c85b 100644 --- a/core/src/test/java/com/linecorp/armeria/client/ContextCancellationTest.java +++ b/core/src/test/java/com/linecorp/armeria/client/ContextCancellationTest.java @@ -48,6 +48,8 @@ import com.linecorp.armeria.common.annotation.Nullable; import com.linecorp.armeria.common.logging.RequestLogAccess; import com.linecorp.armeria.common.stream.SubscriptionOption; +import com.linecorp.armeria.common.util.SafeCloseable; +import com.linecorp.armeria.internal.common.RequestContextUtil; import com.linecorp.armeria.internal.testing.MockAddressResolverGroup; import com.linecorp.armeria.server.ServerBuilder; import com.linecorp.armeria.testing.junit5.common.EventLoopGroupExtension; @@ -245,7 +247,9 @@ void cancel_beforeWriteFinished(TestInfo testInfo) { public void subscribe(Subscriber subscriber, EventExecutor executor, SubscriptionOption... options) { super.subscribe(subscriber, executor, options); - ctxRef.get().cancel(t); + try (SafeCloseable ignored = RequestContextUtil.pop()) { + ctxRef.get().cancel(t); + } } }); assertThatThrownBy(() -> res.aggregate().join())