Skip to content

Commit

Permalink
Fix tests - one more time.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Feb 7, 2024
1 parent d08bec0 commit 4cdfd33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ public byte[] handle(byte[] request) {
public void rethrow_error_if_UDS_channel_closed() {
var client = new TestClient(channelHandler);
stopRustCoreLibMock();
// If we don't sleep, we will get another error - why?
Thread.sleep(200);
try {
var exception =
assertThrows(
Expand Down
4 changes: 3 additions & 1 deletion java/client/src/test/java/glide/utils/RustCoreMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
import java.nio.file.Files;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import lombok.SneakyThrows;
import redis_request.RedisRequestOuterClass.RedisRequest;
Expand Down Expand Up @@ -175,10 +176,11 @@ public static String start(GlideMock messageProcessor) {
return instance.socketPath;
}

@SneakyThrows
public static void stop() {
if (instance != null) {
instance.channel.close().syncUninterruptibly();
instance.group.shutdownGracefully();
instance.group.shutdownGracefully().get(5, TimeUnit.SECONDS);
instance = null;
}
}
Expand Down

0 comments on commit 4cdfd33

Please sign in to comment.