From 7858f0ee2f57ac7d7e018a22fd06ebc776cd61de Mon Sep 17 00:00:00 2001 From: thanicz Date: Thu, 11 Jun 2026 07:41:42 +0200 Subject: [PATCH] KNOX-3345: Fix intermittent testRefreshGatewayConfig test issue --- .../java/org/apache/knox/gateway/GatewayServerTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/GatewayServerTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/GatewayServerTest.java index c6402877be..4ad86d3264 100644 --- a/gateway-server/src/test/java/org/apache/knox/gateway/GatewayServerTest.java +++ b/gateway-server/src/test/java/org/apache/knox/gateway/GatewayServerTest.java @@ -21,7 +21,6 @@ import org.apache.knox.gateway.config.impl.GatewayConfigImpl; import org.easymock.EasyMock; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -48,7 +47,6 @@ public void setup() { } @Test - @Ignore public void testRefreshGatewayConfig() throws Exception { GatewayConfigImpl config = EasyMock.createNiceMock(GatewayConfigImpl.class); @@ -65,6 +63,11 @@ public void testRefreshGatewayConfig() throws Exception { Method refreshMethod = GatewayServer.class.getDeclaredMethod("refreshGatewayConfig", GatewayConfigImpl.class, Path.class); refreshMethod.setAccessible(true); + // Reset static lastReloadTime to ensure test isolation + Field lastReloadTimeField = GatewayServer.class.getDeclaredField("lastReloadTime"); + lastReloadTimeField.setAccessible(true); + lastReloadTimeField.set(null, null); + // Initial load config.reloadConfiguration(); EasyMock.expectLastCall().once(); @@ -75,8 +78,6 @@ public void testRefreshGatewayConfig() throws Exception { EasyMock.verify(config); // Check lastReloadTime is set - Field lastReloadTimeField = GatewayServer.class.getDeclaredField("lastReloadTime"); - lastReloadTimeField.setAccessible(true); FileTime lastReloadTime = (FileTime) lastReloadTimeField.get(null); assertNotNull(lastReloadTime);