fix(openapi): harden story 2.1 production lifecycle
CI / Rust Checks (push) Failing after 4m6s
CI / UI Checks (push) Has been skipped
CI / Frontend E2E (push) Has been skipped
CI / Community Image Smoke (push) Has been skipped
CI / Deploy (push) Has been skipped

This commit is contained in:
2026-08-29 00:48:22 +03:00
parent 2c94af6791
commit bc03c33387
46 changed files with 2198 additions and 276 deletions
+74 -8
View File
@@ -24,23 +24,89 @@ pub async fn health() -> Json<serde_json::Value> {
}
pub async fn readiness(State(state): State<AppState>) -> impl IntoResponse {
match state.service.readiness().await {
Ok(()) => (
let checks = state.service.readiness().await;
let postgres = if checks.postgres {
"ready"
} else {
"not_ready"
};
let artifact_storage = if checks.artifact_storage {
"ready"
} else {
"not_ready"
};
if checks.is_ready() {
(
StatusCode::OK,
Json(json!({
"service": "admin-api",
"status": "ready",
"checks": { "postgres": "ready" }
"checks": { "postgres": postgres, "artifact_storage": artifact_storage }
})),
),
Err(error) => (
)
} else {
(
StatusCode::SERVICE_UNAVAILABLE,
Json(json!({
"service": "admin-api",
"status": "not_ready",
"checks": { "postgres": "not_ready" },
"error": error.to_string()
"checks": { "postgres": postgres, "artifact_storage": artifact_storage }
})),
),
)
}
}
#[cfg(test)]
mod tests {
use crate::service::ReadinessChecks;
#[test]
fn readiness_checks_identify_a_postgres_failure() {
let checks = ReadinessChecks {
postgres: false,
artifact_storage: true,
};
assert!(!checks.is_ready());
assert_eq!(
if checks.postgres {
"ready"
} else {
"not_ready"
},
"not_ready"
);
assert_eq!(
if checks.artifact_storage {
"ready"
} else {
"not_ready"
},
"ready"
);
}
#[test]
fn readiness_checks_identify_an_artifact_storage_failure() {
let checks = ReadinessChecks {
postgres: true,
artifact_storage: false,
};
assert!(!checks.is_ready());
assert_eq!(
if checks.postgres {
"ready"
} else {
"not_ready"
},
"ready"
);
assert_eq!(
if checks.artifact_storage {
"ready"
} else {
"not_ready"
},
"not_ready"
);
}
}