refactor(cli): remove lasuite namespace and services
This commit is contained in:
@@ -448,36 +448,6 @@ async fn check_hydra_oidc(domain: &str, client: &reqwest::Client) -> CheckResult
|
||||
}
|
||||
}
|
||||
|
||||
/// GET https://people.{domain}/ -> any response < 500 (302 to OIDC is fine).
|
||||
async fn check_people(domain: &str, client: &reqwest::Client) -> CheckResult {
|
||||
let url = format!("https://people.{domain}/");
|
||||
match http_get(client, &url, None).await {
|
||||
Ok((status, _)) => CheckResult {
|
||||
name: "people".into(),
|
||||
ns: "lasuite".into(),
|
||||
svc: "people".into(),
|
||||
passed: status < 500,
|
||||
detail: format!("HTTP {status}"),
|
||||
},
|
||||
Err(e) => CheckResult::fail("people", "lasuite", "people", &e),
|
||||
}
|
||||
}
|
||||
|
||||
/// GET /api/v1.0/config/ -> any response < 500 (401 auth-required is fine).
|
||||
async fn check_people_api(domain: &str, client: &reqwest::Client) -> CheckResult {
|
||||
let url = format!("https://people.{domain}/api/v1.0/config/");
|
||||
match http_get(client, &url, None).await {
|
||||
Ok((status, _)) => CheckResult {
|
||||
name: "people-api".into(),
|
||||
ns: "lasuite".into(),
|
||||
svc: "people".into(),
|
||||
passed: status < 500,
|
||||
detail: format!("HTTP {status}"),
|
||||
},
|
||||
Err(e) => CheckResult::fail("people-api", "lasuite", "people", &e),
|
||||
}
|
||||
}
|
||||
|
||||
/// kubectl exec livekit-server pod -- wget localhost:7880/ -> rc 0.
|
||||
async fn check_livekit(_domain: &str, _client: &reqwest::Client) -> CheckResult {
|
||||
let kube_client = match get_client().await {
|
||||
@@ -573,16 +543,6 @@ fn check_registry() -> Vec<CheckEntry> {
|
||||
ns: "ory",
|
||||
svc: "hydra",
|
||||
},
|
||||
CheckEntry {
|
||||
func: |d, c| Box::pin(check_people(d, c)),
|
||||
ns: "lasuite",
|
||||
svc: "people",
|
||||
},
|
||||
CheckEntry {
|
||||
func: |d, c| Box::pin(check_people_api(d, c)),
|
||||
ns: "lasuite",
|
||||
svc: "people",
|
||||
},
|
||||
CheckEntry {
|
||||
func: |d, c| Box::pin(check_livekit(d, c)),
|
||||
ns: "media",
|
||||
@@ -794,7 +754,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_check_registry_has_all_checks() {
|
||||
let registry = check_registry();
|
||||
assert_eq!(registry.len(), 11);
|
||||
assert_eq!(registry.len(), 9);
|
||||
|
||||
// Verify order matches Python CHECKS list
|
||||
assert_eq!(registry[0].ns, "devtools");
|
||||
@@ -813,12 +773,8 @@ mod tests {
|
||||
assert_eq!(registry[6].svc, "kratos");
|
||||
assert_eq!(registry[7].ns, "ory");
|
||||
assert_eq!(registry[7].svc, "hydra");
|
||||
assert_eq!(registry[8].ns, "lasuite");
|
||||
assert_eq!(registry[8].svc, "people");
|
||||
assert_eq!(registry[9].ns, "lasuite");
|
||||
assert_eq!(registry[9].svc, "people");
|
||||
assert_eq!(registry[10].ns, "media");
|
||||
assert_eq!(registry[10].svc, "livekit");
|
||||
assert_eq!(registry[8].ns, "media");
|
||||
assert_eq!(registry[8].svc, "livekit");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -938,7 +894,7 @@ mod tests {
|
||||
let registry = check_registry();
|
||||
let namespaces: std::collections::HashSet<&str> =
|
||||
registry.iter().map(|e| e.ns).collect();
|
||||
for expected in &["devtools", "data", "storage", "ory", "lasuite", "media"] {
|
||||
for expected in &["devtools", "data", "storage", "ory", "media"] {
|
||||
assert!(
|
||||
namespaces.contains(expected),
|
||||
"registry missing namespace: {expected}"
|
||||
@@ -953,7 +909,7 @@ mod tests {
|
||||
registry.iter().map(|e| e.svc).collect();
|
||||
for expected in &[
|
||||
"gitea", "postgres", "valkey", "openbao", "seaweedfs", "kratos", "hydra",
|
||||
"people", "livekit",
|
||||
"livekit",
|
||||
] {
|
||||
assert!(
|
||||
services.contains(expected),
|
||||
@@ -972,16 +928,6 @@ mod tests {
|
||||
assert_eq!(gitea.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_registry_lasuite_has_two_people_entries() {
|
||||
let registry = check_registry();
|
||||
let people: Vec<_> = registry
|
||||
.iter()
|
||||
.filter(|e| e.ns == "lasuite" && e.svc == "people")
|
||||
.collect();
|
||||
assert_eq!(people.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_registry_data_has_three_entries() {
|
||||
let registry = check_registry();
|
||||
@@ -1007,7 +953,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_no_target_runs_all() {
|
||||
let selected = filter_registry(None, None);
|
||||
assert_eq!(selected.len(), 11);
|
||||
assert_eq!(selected.len(), 9);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1038,13 +984,6 @@ mod tests {
|
||||
assert_eq!(selected[0], ("ory", "hydra"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_svc_filter_people_returns_both() {
|
||||
let selected = filter_registry(Some("lasuite"), Some("people"));
|
||||
assert_eq!(selected.len(), 2);
|
||||
assert!(selected.iter().all(|(ns, svc)| *ns == "lasuite" && *svc == "people"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_filter_nonexistent_ns_returns_empty() {
|
||||
let selected = filter_registry(Some("nonexistent"), None);
|
||||
|
||||
@@ -7,12 +7,13 @@ pub const MANAGED_NS: &[&str] = &[
|
||||
"data",
|
||||
"devtools",
|
||||
"ingress",
|
||||
"lasuite",
|
||||
"matrix",
|
||||
"media",
|
||||
"monitoring",
|
||||
"ory",
|
||||
"stalwart",
|
||||
"storage",
|
||||
"vault-secrets-operator",
|
||||
"vpn",
|
||||
"wfe",
|
||||
];
|
||||
|
||||
@@ -778,23 +778,23 @@ mod tests {
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: meet-config
|
||||
namespace: lasuite
|
||||
name: stalwart-config
|
||||
namespace: stalwart
|
||||
data:
|
||||
FOO: bar
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: meet-backend
|
||||
namespace: lasuite
|
||||
name: stalwart
|
||||
namespace: stalwart
|
||||
spec:
|
||||
replicas: 1
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: lasuite
|
||||
name: stalwart
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
@@ -816,14 +816,14 @@ spec:
|
||||
|
||||
#[test]
|
||||
fn test_keeps_matching_namespace() {
|
||||
let result = filter_by_namespace(MULTI_DOC, "lasuite");
|
||||
assert!(result.contains("name: meet-config"));
|
||||
assert!(result.contains("name: meet-backend"));
|
||||
let result = filter_by_namespace(MULTI_DOC, "stalwart");
|
||||
assert!(result.contains("name: stalwart-config"));
|
||||
assert!(result.contains("name: stalwart\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_excludes_other_namespaces() {
|
||||
let result = filter_by_namespace(MULTI_DOC, "lasuite");
|
||||
let result = filter_by_namespace(MULTI_DOC, "stalwart");
|
||||
assert!(!result.contains("namespace: ingress"));
|
||||
assert!(!result.contains("name: pingora-config"));
|
||||
assert!(!result.contains("name: pingora\n"));
|
||||
@@ -831,7 +831,7 @@ spec:
|
||||
|
||||
#[test]
|
||||
fn test_includes_namespace_resource_itself() {
|
||||
let result = filter_by_namespace(MULTI_DOC, "lasuite");
|
||||
let result = filter_by_namespace(MULTI_DOC, "stalwart");
|
||||
assert!(result.contains("kind: Namespace"));
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ spec:
|
||||
let result = filter_by_namespace(MULTI_DOC, "ingress");
|
||||
assert!(result.contains("name: pingora-config"));
|
||||
assert!(result.contains("name: pingora"));
|
||||
assert!(!result.contains("namespace: lasuite"));
|
||||
assert!(!result.contains("namespace: stalwart"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -851,13 +851,13 @@ spec:
|
||||
|
||||
#[test]
|
||||
fn test_empty_input_returns_empty() {
|
||||
let result = filter_by_namespace("", "lasuite");
|
||||
let result = filter_by_namespace("", "stalwart");
|
||||
assert!(result.trim().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_result_starts_with_separator() {
|
||||
let result = filter_by_namespace(MULTI_DOC, "lasuite");
|
||||
let result = filter_by_namespace(MULTI_DOC, "stalwart");
|
||||
assert!(result.starts_with("---"));
|
||||
}
|
||||
|
||||
@@ -877,7 +877,7 @@ spec:
|
||||
#[test]
|
||||
fn test_single_doc_not_matching() {
|
||||
let doc = "apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: x\n namespace: ory\n";
|
||||
let result = filter_by_namespace(doc, "lasuite");
|
||||
let result = filter_by_namespace(doc, "stalwart");
|
||||
assert!(result.trim().is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,19 +25,10 @@ pub(crate) const PG_USERS: &[&str] = &[
|
||||
"kratos",
|
||||
"hydra",
|
||||
"gitea",
|
||||
"hive",
|
||||
"docs",
|
||||
"meet",
|
||||
"drive",
|
||||
"messages",
|
||||
"conversations",
|
||||
"people",
|
||||
"find",
|
||||
"calendars",
|
||||
"projects",
|
||||
"penpot",
|
||||
"stalwart",
|
||||
"headscale",
|
||||
"wfe",
|
||||
];
|
||||
|
||||
pub(crate) const SMTP_URI: &str = "smtp://postfix.lasuite.svc.cluster.local:25/?skip_ssl_verify=true";
|
||||
@@ -469,9 +460,11 @@ mod tests {
|
||||
fn test_constants() {
|
||||
assert_eq!(ADMIN_USERNAME, "estudio-admin");
|
||||
assert_eq!(GITEA_ADMIN_USER, "gitea_admin");
|
||||
assert_eq!(PG_USERS.len(), 16);
|
||||
assert_eq!(PG_USERS.len(), 7);
|
||||
assert!(PG_USERS.contains(&"kratos"));
|
||||
assert!(PG_USERS.contains(&"projects"));
|
||||
assert!(PG_USERS.contains(&"hydra"));
|
||||
assert!(PG_USERS.contains(&"wfe"));
|
||||
assert!(PG_USERS.contains(&"headscale"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -502,24 +495,15 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pg_users_match_python() {
|
||||
fn test_pg_users_canonical_order() {
|
||||
let expected = vec![
|
||||
"kratos",
|
||||
"hydra",
|
||||
"gitea",
|
||||
"hive",
|
||||
"docs",
|
||||
"meet",
|
||||
"drive",
|
||||
"messages",
|
||||
"conversations",
|
||||
"people",
|
||||
"find",
|
||||
"calendars",
|
||||
"projects",
|
||||
"penpot",
|
||||
"stalwart",
|
||||
"headscale",
|
||||
"wfe",
|
||||
];
|
||||
assert_eq!(PG_USERS, &expected[..]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user