feat: health endpoint (#139)

* feat: add /_floci/health endpoint and Dockerfile.seed for persistence
* chore: remove Dockerfile.seed and persistence docs, keep health endpoint only
* fix: address PR review comments on health endpoint

- Change edition from 'community' to 'floci-open-source'
- Show all services in health response (enabled='running', disabled='available')
- Support both /_floci/health and /_localstack/health paths for backward compatibility

* fix: use floci-always-free edition value per reviewer preference
* test: assert full JSON response in health endpoint tests
* test: use raw JSON string for health endpoint assertion
This commit is contained in:
Matej Šnuderl authored and GitHub committed 2026-04-02 18:05:35 -05:00
1 parent fe2480e596
commit fb42087631
3 files changed
+159

No files matched your search

@@ -0,0 +1,73 @@
package io.github.hectorvent.floci.lifecycle;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.junit.jupiter.api.Assertions.assertEquals;
@QuarkusTest
class HealthControllerIntegrationTest {
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final String EXPECTED_HEALTH_JSON = """
{
"services": {
"ssm": "running",
"sqs": "running",
"s3": "running",
"dynamodb": "running",
"sns": "running",
"lambda": "running",
"apigateway": "running",
"iam": "running",
"elasticache": "running",
"rds": "running",
"events": "running",
"logs": "running",
"monitoring": "running",
"secretsmanager": "running",
"apigatewayv2": "running",
"kinesis": "running",
"kms": "running",
"cognito-idp": "running",
"states": "running",
"cloudformation": "running",
"acm": "running",
"email": "running",
"es": "running"
},
"edition": "floci-always-free",
"version": "dev"
}
""";
@Test
void healthEndpoint_returnsExpectedJson() throws Exception {
String body = given()
.when()
.get("/_floci/health")
.then()
.statusCode(200)
.contentType("application/json")
.extract().body().asString();
assertEquals(MAPPER.readTree(EXPECTED_HEALTH_JSON), MAPPER.readTree(body));
}
@Test
void healthEndpoint_localstackCompatPath() throws Exception {
String body = given()
.when()
.get("/_localstack/health")
.then()
.statusCode(200)
.contentType("application/json")
.extract().body().asString();
assertEquals(MAPPER.readTree(EXPECTED_HEALTH_JSON), MAPPER.readTree(body));
}
}