From 813f25a01fe35958b2ac2282d8f7f371f1471af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kohlschu=CC=88tter?= Date: Fri, 19 Apr 2024 14:45:09 +0200 Subject: [PATCH] test: rmi: Wait for up to 5 seconds instead of 500ms testRemoteShutdownNotAllowed may erroneously fail on a busy machine. --- .../org/newsclub/net/unix/rmi/RemoteRegistryTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/junixsocket-rmi/src/test/java/org/newsclub/net/unix/rmi/RemoteRegistryTest.java b/junixsocket-rmi/src/test/java/org/newsclub/net/unix/rmi/RemoteRegistryTest.java index 6bdbfee37..b21d98c03 100644 --- a/junixsocket-rmi/src/test/java/org/newsclub/net/unix/rmi/RemoteRegistryTest.java +++ b/junixsocket-rmi/src/test/java/org/newsclub/net/unix/rmi/RemoteRegistryTest.java @@ -141,14 +141,14 @@ protected int shutdownAfterSecs() { assertThrows(ServerException.class, () -> sra.getRegistry().getNaming().shutdownRegistry()); sra.shutdownAndWait(false); - if (!awaitNoRMIFiles(socketDir, 5)) { + if (!awaitNoRMIFiles(socketDir)) { sra.shutdownAndWait(true); } } catch (Exception e) { throw e; } - assertTrue(awaitNoRMIFiles(socketDir, 5), "There shouldn't be any RMI socket files in " + assertTrue(awaitNoRMIFiles(socketDir), "There shouldn't be any RMI socket files in " + socketDir); } finally { assertTrue(deleteDirectory(socketDir), "Should be able to delete temporary directory: " @@ -156,9 +156,9 @@ protected int shutdownAfterSecs() { } } - private boolean awaitNoRMIFiles(File socketDir, int loops) throws InterruptedException { + private boolean awaitNoRMIFiles(File socketDir) throws InterruptedException { int count = 0; - for (int i = 0; i < loops; i++) { + for (int i = 0; i < 50; i++) { count = countRMIFiles(socketDir); if (count == 0) { return true;