mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix: init shows wrong status when tls is enabled and adding app config (#1006)
* fix(lifecycle,appconfig): TLS startup readiness and listHostedConfigurationVersions
Fixes two independent issues:
is enabled, Quarkus binds the HTTP backend on port 4510 and the HttpServerStart
event fires with that port, so markStartCompleted/markReadyCompleted were never
called and /_floci/init always returned ready=false. Fix: derive the expected
port from config.tls().enabled() at observer time.
/applications/{appId}/configurationprofiles/{profileId}/hostedconfigurationversions.
Unmatched requests fell through to S3Controller's catch-all and returned a
NoSuchBucket XML error. Fix: add HostedConfigurationVersionSummary model,
listHostedConfigurationVersions service method, and the missing GET route.
* fix(commit-checks): fix action that check commit format
This commit is contained in:
1 parent
be01ee0747
commit
bf093ce0f4
7 files changed
+180
-35
No files matched your search
@@ -19,6 +19,8 @@ import io.github.hectorvent.floci.services.rds.proxy.RdsProxyManager;
|
||||
import io.quarkus.runtime.ShutdownDelayInitiatedEvent;
|
||||
import io.quarkus.runtime.ShutdownEvent;
|
||||
import io.quarkus.runtime.StartupEvent;
|
||||
import io.quarkus.vertx.http.HttpServerStart;
|
||||
import io.vertx.core.http.HttpServerOptions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -126,6 +128,54 @@ class EmulatorLifecycleTest {
|
||||
verify(initLifecycleState, never()).markStartCompleted();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("onHttpStart on port 4566 (non-TLS) triggers hook execution and marks lifecycle completed")
|
||||
void onHttpStart_nonTls_triggersHooksOnPort4566() throws IOException, InterruptedException {
|
||||
when(tlsConfig.enabled()).thenReturn(false);
|
||||
when(initializationHooksRunner.hasHooks(InitializationHook.START)).thenReturn(true);
|
||||
when(initializationHooksRunner.hasHooks(InitializationHook.READY)).thenReturn(false);
|
||||
|
||||
emulatorLifecycle.onHttpStart(new HttpServerStart(new HttpServerOptions().setPort(4566)));
|
||||
|
||||
verify(initializationHooksRunner).run(InitializationHook.START);
|
||||
verify(initLifecycleState).markStartCompleted();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("onHttpStart on wrong port (non-TLS) is ignored")
|
||||
void onHttpStart_nonTls_ignoresWrongPort() throws IOException, InterruptedException {
|
||||
when(tlsConfig.enabled()).thenReturn(false);
|
||||
|
||||
emulatorLifecycle.onHttpStart(new HttpServerStart(new HttpServerOptions().setPort(4510)));
|
||||
|
||||
verify(initializationHooksRunner, never()).run(InitializationHook.START);
|
||||
verify(initLifecycleState, never()).markStartCompleted();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("onHttpStart on port 4510 (TLS mode) triggers hook execution and marks lifecycle completed")
|
||||
void onHttpStart_tls_triggersHooksOnBackendPort4510() throws IOException, InterruptedException {
|
||||
when(tlsConfig.enabled()).thenReturn(true);
|
||||
when(initializationHooksRunner.hasHooks(InitializationHook.START)).thenReturn(true);
|
||||
when(initializationHooksRunner.hasHooks(InitializationHook.READY)).thenReturn(false);
|
||||
|
||||
emulatorLifecycle.onHttpStart(new HttpServerStart(new HttpServerOptions().setPort(4510)));
|
||||
|
||||
verify(initializationHooksRunner).run(InitializationHook.START);
|
||||
verify(initLifecycleState).markStartCompleted();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("onHttpStart on port 4566 (TLS mode) is ignored — public port is not the backend port")
|
||||
void onHttpStart_tls_ignoresPublicPort4566() throws IOException, InterruptedException {
|
||||
when(tlsConfig.enabled()).thenReturn(true);
|
||||
|
||||
emulatorLifecycle.onHttpStart(new HttpServerStart(new HttpServerOptions().setPort(4566)));
|
||||
|
||||
verify(initializationHooksRunner, never()).run(InitializationHook.START);
|
||||
verify(initLifecycleState, never()).markStartCompleted();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Should run shutdown hooks in the pre-shutdown phase, before the HTTP server stops")
|
||||
void shouldRunShutdownHooksInPreShutdownPhase() throws IOException, InterruptedException {
|
||||
|
||||
+26
-9
@@ -210,9 +210,26 @@ class AppConfigIntegrationTest {
|
||||
.header("Next-Poll-Configuration-Token", notNullValue());
|
||||
}
|
||||
|
||||
// ──────────────────────────── Builtin deployment strategies ────────────────────────────
|
||||
// ──────────────────────────── Hosted Configuration Version list ────────────────────────────
|
||||
|
||||
@Test @Order(13)
|
||||
void listHostedConfigurationVersionsReturnsBothVersions() {
|
||||
given()
|
||||
.when().get("/applications/" + appId + "/configurationprofiles/" + profileId + "/hostedconfigurationversions")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Items.size()", equalTo(2))
|
||||
.body("Items[0].VersionNumber", equalTo(1))
|
||||
.body("Items[0].ContentType", startsWith("application/json"))
|
||||
.body("Items[0].ApplicationId", equalTo(appId))
|
||||
.body("Items[0].ConfigurationProfileId", equalTo(profileId))
|
||||
.body("Items[1].VersionNumber", equalTo(2))
|
||||
.body("Items.Content", everyItem(nullValue()));
|
||||
}
|
||||
|
||||
// ──────────────────────────── Builtin deployment strategies ────────────────────────────
|
||||
|
||||
@Test @Order(14)
|
||||
void builtinStrategyAllAtOnceCanBeUsedWithoutCreating() {
|
||||
given()
|
||||
.contentType(ContentType.JSON)
|
||||
@@ -226,7 +243,7 @@ class AppConfigIntegrationTest {
|
||||
|
||||
// ──────────────────────────── Application tagging ────────────────────────────
|
||||
|
||||
@Test @Order(14)
|
||||
@Test @Order(15)
|
||||
void listTagsOnNewApplicationIsEmpty() {
|
||||
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId;
|
||||
given()
|
||||
@@ -236,7 +253,7 @@ class AppConfigIntegrationTest {
|
||||
.body("Tags", anEmptyMap());
|
||||
}
|
||||
|
||||
@Test @Order(15)
|
||||
@Test @Order(16)
|
||||
void tagApplication() {
|
||||
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId;
|
||||
given()
|
||||
@@ -247,7 +264,7 @@ class AppConfigIntegrationTest {
|
||||
.statusCode(204);
|
||||
}
|
||||
|
||||
@Test @Order(16)
|
||||
@Test @Order(17)
|
||||
void listTagsAfterTagging() {
|
||||
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId;
|
||||
given()
|
||||
@@ -258,7 +275,7 @@ class AppConfigIntegrationTest {
|
||||
.body("Tags.team", equalTo("platform"));
|
||||
}
|
||||
|
||||
@Test @Order(17)
|
||||
@Test @Order(18)
|
||||
void untagApplication() {
|
||||
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId;
|
||||
given()
|
||||
@@ -267,7 +284,7 @@ class AppConfigIntegrationTest {
|
||||
.statusCode(204);
|
||||
}
|
||||
|
||||
@Test @Order(18)
|
||||
@Test @Order(19)
|
||||
void listTagsAfterUntagging() {
|
||||
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId;
|
||||
given()
|
||||
@@ -280,7 +297,7 @@ class AppConfigIntegrationTest {
|
||||
|
||||
// ──────────────────────────── Tags on non-application resources (no-op) ────────────────────────────
|
||||
|
||||
@Test @Order(19)
|
||||
@Test @Order(20)
|
||||
void listTagsForEnvironmentArnReturnsEmpty() {
|
||||
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId + "/environment/" + envId;
|
||||
given()
|
||||
@@ -290,7 +307,7 @@ class AppConfigIntegrationTest {
|
||||
.body("Tags", anEmptyMap());
|
||||
}
|
||||
|
||||
@Test @Order(20)
|
||||
@Test @Order(21)
|
||||
void listTagsForDeploymentArnReturnsEmpty() {
|
||||
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId + "/environment/" + envId + "/deployment/1";
|
||||
given()
|
||||
@@ -300,7 +317,7 @@ class AppConfigIntegrationTest {
|
||||
.body("Tags", anEmptyMap());
|
||||
}
|
||||
|
||||
@Test @Order(21)
|
||||
@Test @Order(22)
|
||||
void emptyConfigurationReturnsEmptyPayload() {
|
||||
emptyAppId = given()
|
||||
.contentType(ContentType.JSON)
|
||||
|
||||
Reference in new issue
Block a user