Skip to main content

devboy_confluence/
liveness.rs

1//! Confluence [`LivenessProbe`] stub per [ADR-021] §6.
2//!
3//! Confluence Server / Data Center exposes
4//! `GET /rest/api/user/current` (Cloud uses
5//! `/wiki/rest/api/user/current`); routing the response through
6//! the typed liveness shape requires distinguishing Server vs
7//! Cloud auth modes. The stub uses the trait's default `test`
8//! impl (returns [`LivenessStatus::NotImplemented`]) so `doctor`
9//! shows a clear "not implemented" line until a real probe lands.
10//!
11//! [ADR-021]: https://github.com/meteora-pro/devboy-tools/blob/main/docs/architecture/adr/ADR-021-external-secret-sources.md
12//! [`LivenessStatus::NotImplemented`]: devboy_core::liveness::LivenessStatus
13
14use async_trait::async_trait;
15use devboy_core::LivenessProbe;
16
17use crate::client::ConfluenceClient;
18
19#[async_trait]
20impl LivenessProbe for ConfluenceClient {
21    fn provider_name(&self) -> &str {
22        "confluence"
23    }
24}
25
26#[cfg(test)]
27mod tests {
28    use super::*;
29    use crate::client::ConfluenceAuth;
30    use devboy_core::liveness::LivenessStatus;
31    use secrecy::SecretString;
32
33    #[tokio::test]
34    async fn provider_name_is_confluence_and_default_returns_not_implemented() {
35        let client = ConfluenceClient::new(
36            "https://example.atlassian.net/wiki",
37            ConfluenceAuth::BearerToken(SecretString::from("any".to_owned())),
38        );
39        assert_eq!(client.provider_name(), "confluence");
40        let r = client
41            .test(&SecretString::from("any".to_owned()))
42            .await
43            .unwrap();
44        assert_eq!(r.status, LivenessStatus::NotImplemented);
45        assert!(r.detail.unwrap().contains("confluence"));
46    }
47}