mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(msk): poll correct Redpanda admin readiness endpoint (#1237)
* fix(msk): poll correct Redpanda admin readiness endpoint * test(msk): pin RedpandaManager.isReady() to the /v1/status/ready admin path isReady() resolves an admin URL and polls it for a 200 to decide whether the Redpanda container is ready, but nothing asserted which path it hits. Add RedpandaManagerTest.isReadyPollsTheCorrectAdminReadinessPathInNativeMode: a local HTTP server stands in for Redpanda's admin API (200 on /v1/status/ready, 404 on /ready — the previously-polled path that always 404s), the Docker container-inspect chain is mocked to resolve the admin port binding to that server, and isReady() is asserted to report ready. Reverting ADMIN_READY_PATH to /ready makes the assertion fail, pinning the fix as a regression guard.
This commit is contained in:
1 parent
27943b35c3
commit
2b466bf980
2 files changed
+107
-3
No files matched your search
@@ -29,7 +29,10 @@ public class RedpandaManager {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(RedpandaManager.class);
|
||||
private static final int KAFKA_PORT = 9092;
|
||||
private static final int ADMIN_PORT = 9644;
|
||||
static final int ADMIN_PORT = 9644;
|
||||
|
||||
// Redpanda's Admin API exposes readiness at /v1/status/ready. /ready always returns 404
|
||||
private static final String ADMIN_READY_PATH = "/v1/status/ready";
|
||||
|
||||
private final ContainerBuilder containerBuilder;
|
||||
private final ContainerLifecycleManager lifecycleManager;
|
||||
@@ -137,13 +140,13 @@ public class RedpandaManager {
|
||||
var bindings = inspect.getNetworkSettings().getPorts().getBindings();
|
||||
var binding = bindings.get(com.github.dockerjava.api.model.ExposedPort.tcp(ADMIN_PORT));
|
||||
if (binding != null && binding.length > 0) {
|
||||
adminUrl = "http://localhost:" + binding[0].getHostPortSpec() + "/ready";
|
||||
adminUrl = "http://localhost:" + binding[0].getHostPortSpec() + ADMIN_READY_PATH;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
String containerIp = bootstrap.split(":")[0];
|
||||
adminUrl = "http://" + containerIp + ":" + ADMIN_PORT + "/ready";
|
||||
adminUrl = "http://" + containerIp + ":" + ADMIN_PORT + ADMIN_READY_PATH;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user