This is an automated email from the ASF dual-hosted git repository.
amagyar 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 1eeaf7315 Revert "KNOX-2962 - Knox readiness check gateway-status
endpoint should return the list of topologies for which it is waiting for
(#800)" (#803)
1eeaf7315 is described below
commit 1eeaf7315372bd7f8592e828dcac61740ba64581
Author: Attila Magyar <[email protected]>
AuthorDate: Wed Oct 11 18:19:45 2023 +0200
Revert "KNOX-2962 - Knox readiness check gateway-status endpoint should
return the list of topologies for which it is waiting for (#800)" (#803)
This reverts commit ff6bcbcac5c5d0e8f00f4944207975f5b1bfeebf.
---
.../services/topology/impl/GatewayStatusService.java | 9 ++-------
.../topology/impl/GatewayStatusServiceTest.java | 18 ------------------
.../knox/gateway/service/health/PingResource.java | 2 +-
3 files changed, 3 insertions(+), 26 deletions(-)
diff --git
a/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusService.java
b/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusService.java
index 1cc447245..08ad866b2 100644
---
a/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusService.java
+++
b/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusService.java
@@ -45,15 +45,10 @@ public class GatewayStatusService implements Service {
LOG.noTopologiesToCheck();
return false;
}
- Set<String> missing = pendingTopologies();
- LOG.checkingGatewayStatus(deployedTopologies, missing);
- return missing.isEmpty();
- }
-
- public synchronized Set<String> pendingTopologies() {
Set<String> missing = new HashSet<>(topologyNamesToCheck);
missing.removeAll(deployedTopologies);
- return missing;
+ LOG.checkingGatewayStatus(deployedTopologies, missing);
+ return missing.isEmpty();
}
/**
diff --git
a/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusServiceTest.java
b/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusServiceTest.java
index 8e121a1b9..fe866a660 100644
---
a/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusServiceTest.java
+++
b/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusServiceTest.java
@@ -17,12 +17,10 @@
*/
package org.apache.knox.gateway.services.topology.impl;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import org.apache.knox.gateway.config.GatewayConfig;
@@ -45,20 +43,4 @@ public class GatewayStatusServiceTest {
statusService.onTopologyReady("t2");
assertTrue(statusService.status());
}
-
- @Test
- public void testPendingTopologies() throws Exception {
- GatewayStatusService statusService = new GatewayStatusService();
- GatewayConfig config = EasyMock.createNiceMock(GatewayConfig.class);
- statusService.init(config, null);
- assertFalse(statusService.status());
- EasyMock.expect(config.getHealthCheckTopologies()).andReturn(new
HashSet<>(Arrays.asList("t1", "t2"))).anyTimes();
- EasyMock.replay(config);
- statusService.initTopologiesToCheck();
- assertEquals(new HashSet<>(Arrays.asList("t1", "t2")),
statusService.pendingTopologies());
- statusService.onTopologyReady("t1");
- assertEquals(new HashSet<>(Arrays.asList("t2")),
statusService.pendingTopologies());
- statusService.onTopologyReady("t2");
- assertEquals(Collections.emptySet(), statusService.pendingTopologies());
- }
}
\ No newline at end of file
diff --git
a/gateway-service-health/src/main/java/org/apache/knox/gateway/service/health/PingResource.java
b/gateway-service-health/src/main/java/org/apache/knox/gateway/service/health/PingResource.java
index 0a58aeaa5..2d4f4e720 100644
---
a/gateway-service-health/src/main/java/org/apache/knox/gateway/service/health/PingResource.java
+++
b/gateway-service-health/src/main/java/org/apache/knox/gateway/service/health/PingResource.java
@@ -101,7 +101,7 @@ public class PingResource {
.getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
GatewayStatusService statusService =
services.getService(ServiceType.GATEWAY_STATUS_SERVICE);
try (PrintWriter writer = response.getWriter()) {
- writer.println(statusService.status() ? OK : PENDING + ": " +
statusService.pendingTopologies());
+ writer.println(statusService.status() ? OK : PENDING);
} catch (IOException e) {
log.logException("status", e);
return Response.serverError().entity(String.format(Locale.ROOT, "Failed
to reply correctly due to : %s ", e)).build();