You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by ha...@apache.org on 2026/06/11 10:11:35 UTC

(knox) branch master updated: KNOX-3345: Fix intermittent testRefreshGatewayConfig test issue (#1259)

This is an automated email from the ASF dual-hosted git repository.

hanicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 7c94926b1 KNOX-3345: Fix intermittent testRefreshGatewayConfig test issue (#1259)
7c94926b1 is described below

commit 7c94926b1cc967212ed12beb8aa36054677548d8
Author: hanicz <ha...@users.noreply.github.com>
AuthorDate: Thu Jun 11 12:11:31 2026 +0200

    KNOX-3345: Fix intermittent testRefreshGatewayConfig test issue (#1259)
---
 .../src/test/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 c6402877b..4ad86d326 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.GatewayConfigChangeListener;
 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 class GatewayServerTest {
   }
 
   @Test
-  @Ignore
   public void testRefreshGatewayConfig() throws Exception {
     GatewayConfigImpl config = EasyMock.createNiceMock(GatewayConfigImpl.class);
 
@@ -65,6 +63,11 @@ public class GatewayServerTest {
     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 class GatewayServerTest {
     EasyMock.verify(config);
 
     // Check lastReloadTime is set
-    Field lastReloadTimeField = GatewayServer.class.getDeclaredField("lastReloadTime");
-    lastReloadTimeField.setAccessible(true);
     FileTime lastReloadTime = (FileTime) lastReloadTimeField.get(null);
     assertNotNull(lastReloadTime);