mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(lifecycle): run start/ready hooks when FLOCI_PORT is non-default (#2439)
onHttpStart compared the HTTP server port against a hardcoded 4566, but
Quarkus actually listens on floci.port (quarkus.http.port: ${floci.port}).
With any non-default FLOCI_PORT the guard never matched, so start/ready
hooks never ran and /_floci/init stayed stuck at boot:true forever while
/_floci/health returned 200.
Compare against config.port() instead. TLS mode is unchanged: TlsConfigSource
pins the HTTP backend to 4510 regardless of floci.port.
Fixes #2437
Co-authored-by: anmolxlight <anmolxlight@users.noreply.github.com>
This commit is contained in:
1 parent
39ed7712a7
commit
ba97c084eb
2 files changed
+22
-2
No files matched your search
@@ -99,6 +99,7 @@ class EmulatorLifecycleTest {
|
||||
Mockito.lenient().when(elbv2ServiceConfig.enabled()).thenReturn(false);
|
||||
Mockito.lenient().when(config.tls()).thenReturn(tlsConfig);
|
||||
Mockito.lenient().when(tlsConfig.enabled()).thenReturn(false);
|
||||
Mockito.lenient().when(config.port()).thenReturn(4566);
|
||||
|
||||
emulatorLifecycle = new EmulatorLifecycle(
|
||||
storageFactory, serviceRegistry, config,
|
||||
@@ -254,6 +255,22 @@ class EmulatorLifecycleTest {
|
||||
verify(initLifecycleState).markStartCompleted();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("onHttpStart on a non-default floci.port (non-TLS) triggers hook execution (#2437)")
|
||||
void onHttpStart_nonTls_triggersHooksOnCustomPort() throws IOException, InterruptedException {
|
||||
Mockito.lenient().when(config.port()).thenReturn(4577);
|
||||
when(tlsConfig.enabled()).thenReturn(false);
|
||||
when(initializationHooksRunner.hasHooks(InitializationHook.START)).thenReturn(true);
|
||||
when(initializationHooksRunner.hasHooks(InitializationHook.READY)).thenReturn(true);
|
||||
|
||||
emulatorLifecycle.onHttpStart(new HttpServerStart(new HttpServerOptions().setPort(4577)));
|
||||
|
||||
verify(initializationHooksRunner).run(InitializationHook.START);
|
||||
verify(initializationHooksRunner).run(InitializationHook.READY);
|
||||
verify(initLifecycleState).markStartCompleted();
|
||||
verify(initLifecycleState).markReadyCompleted();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("onHttpStart on wrong port (non-TLS) is ignored")
|
||||
void onHttpStart_nonTls_ignoresWrongPort() throws IOException, InterruptedException {
|
||||
|
||||
Reference in new issue
Block a user