devboy_slack/liveness.rs
1//! Slack [`LivenessProbe`] stub per [ADR-021] §6.
2//!
3//! Slack's `auth.test` API method validates the bot token and
4//! returns workspace + bot user info. Routing the response into
5//! the typed liveness shape (active / revoked / expired) is a
6//! follow-up. The stub uses the trait's default `test` impl
7//! (returns [`LivenessStatus::NotImplemented`]) until the real
8//! probe lands.
9//!
10//! [ADR-021]: https://github.com/meteora-pro/devboy-tools/blob/main/docs/architecture/adr/ADR-021-external-secret-sources.md
11//! [`LivenessStatus::NotImplemented`]: devboy_core::liveness::LivenessStatus
12
13use async_trait::async_trait;
14use devboy_core::LivenessProbe;
15
16use crate::client::SlackClient;
17
18#[async_trait]
19impl LivenessProbe for SlackClient {
20 fn provider_name(&self) -> &str {
21 "slack"
22 }
23}
24
25#[cfg(test)]
26mod tests {
27 use super::*;
28 use devboy_core::liveness::LivenessStatus;
29 use secrecy::SecretString;
30
31 #[tokio::test]
32 async fn provider_name_is_slack_and_default_returns_not_implemented() {
33 let client = SlackClient::new(SecretString::from("any".to_owned()));
34 assert_eq!(client.provider_name(), "slack");
35 let r = client
36 .test(&SecretString::from("any".to_owned()))
37 .await
38 .unwrap();
39 assert_eq!(r.status, LivenessStatus::NotImplemented);
40 }
41}