Skip to content

Commit

Permalink
Fix flaky AccessLoggerIntegrationTest (#5599)
Browse files Browse the repository at this point in the history
Motivation:

`ServiceRequestContext` does not implement `equals()` which results in
an intermittent failure due to comparing instance references.

ref:
https://github.com/line/armeria/actions/runs/8655794720/job/23735309425?pr=5593#step:10:1210

Modifications:

- Compare the requestId instead

Result:

- Less flaky tests

---------

Co-authored-by: Trustin Lee <trustin@linecorp.com>
  • Loading branch information
jrhee17 and trustin authored May 8, 2024
1 parent 5bbcdca commit bfd4e74
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.linecorp.armeria.server.logging;

import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;

import java.util.concurrent.atomic.AtomicReference;

Expand Down Expand Up @@ -59,6 +60,7 @@ void testAccessLogger() throws Exception {
assertThat(server.blockingWebClient().get("/").status().code()).isEqualTo(200);
assertThat(server.requestContextCaptor().size()).isEqualTo(1);
final ServiceRequestContext ctx = server.requestContextCaptor().poll();
assertThat(CTX_REF).hasValue(ctx);
assertThat(ctx).isNotNull();
await().untilAsserted(() -> assertThat(CTX_REF).hasValue(ctx));
}
}

0 comments on commit bfd4e74

Please sign in to comment.