style(arr): formatting

This commit is contained in:
Miguel Palhas
2026-08-25 06:28:20 +01:00
parent a836967e32
commit a4422e26e5
7 changed files with 57 additions and 27 deletions
+19 -12
View File
@@ -136,8 +136,12 @@ pub struct HealthReport {
pub async fn health(State(state): State<AppState>) -> Json<HealthReport> {
// Independent network probes; serialising them would make the endpoint
// as slow as the sum of the timeouts.
let (prowlarr, transmission, tmdb, subtitles) =
tokio::join!(probe_prowlarr(&state), probe_transmission(&state), probe_tmdb(&state), probe_subtitles(&state));
let (prowlarr, transmission, tmdb, subtitles) = tokio::join!(
probe_prowlarr(&state),
probe_transmission(&state),
probe_tmdb(&state),
probe_subtitles(&state)
);
let status = if [prowlarr.status, transmission.status, tmdb.status]
.into_iter()
@@ -307,9 +311,7 @@ fn check_from(result: Result<(), arr_subs::Error>) -> Check {
fn backend_check(result: Result<(), backend_error::Error>) -> Check {
match result {
Ok(()) => Check::ok(),
Err(backend_error::Error::Unauthorized { .. }) => {
Check::unreachable("credentials refused")
}
Err(backend_error::Error::Unauthorized { .. }) => Check::unreachable("credentials refused"),
Err(error) => Check::unreachable(error.to_string()),
}
}
@@ -330,11 +332,11 @@ mod tests {
use std::sync::Arc;
use arr_db::Db;
use arr_subs::translate as backend;
use arr_subs::{
Backend, CandidateId, DownloadFuture, Provider, ProviderId, SearchFuture, SearchRequest,
Syncer,
};
use arr_subs::translate as backend;
use crate::{router, AppState, Upstreams};
@@ -497,7 +499,10 @@ mod tests {
set_enabled(&state, r#"["ok","bad"]"#, None).await;
let state = state.with_subtitle_providers(vec![
Arc::new(StubProvider { id: "ok", up: true }),
Arc::new(StubProvider { id: "bad", up: false }),
Arc::new(StubProvider {
id: "bad",
up: false,
}),
]);
let body = report(state).await;
@@ -505,7 +510,10 @@ mod tests {
assert_eq!(body["subtitles"]["providers"][0]["status"], "ok");
assert_eq!(body["subtitles"]["providers"][1]["id"], "bad");
assert_eq!(body["subtitles"]["providers"][1]["status"], "unreachable");
assert_eq!(body["subtitles"]["providers"][1]["detail"], "credentials refused");
assert_eq!(
body["subtitles"]["providers"][1]["detail"],
"credentials refused"
);
}
#[tokio::test]
@@ -524,10 +532,9 @@ mod tests {
async fn an_unreachable_engine_fails_the_whole_report() {
let (_dir, state) = application().await;
set_enabled(&state, "[]", Some("openai")).await;
let state = state
.with_translation_backends(vec![Arc::new(StubBackend {
detail: "connection refused",
})]);
let state = state.with_translation_backends(vec![Arc::new(StubBackend {
detail: "connection refused",
})]);
let body = report(state).await;
assert_eq!(body["subtitles"]["translation"]["status"], "unreachable");