:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(personhog-test-harness): add identity as a chaos target (#124194)
Zach Brownb7715c49697e
diff --git a/rust/personhog-test-harness/src/cli.rs b/rust/personhog-test-harness/src/cli.rsindex c42c832fbe1d..4a12b862080c 100644--- a/rust/personhog-test-harness/src/cli.rs+++ b/rust/personhog-test-harness/src/cli.rs@@ -691,6 +691,13 @@ pub struct TrafficArgs {)]pub chaos_writer_namespace: String,+ #[arg(+ long,+ env = "CHAOS_IDENTITY_NAMESPACE",+ default_value = "personhog-identity"+ )]+ pub chaos_identity_namespace: String,+/// etcd endpoints of the stack under test (comma-separated). Enables/// the coordinator-targeted scenarios, which resolve the live/// election holder; absent, those scenarios are excluded.diff --git a/rust/personhog-test-harness/src/scenarios/chaos.rs b/rust/personhog-test-harness/src/scenarios/chaos.rsindex 058efe2258d9..fb4f1555be81 100644--- a/rust/personhog-test-harness/src/scenarios/chaos.rs+++ b/rust/personhog-test-harness/src/scenarios/chaos.rs@@ -46,6 +46,7 @@ pub enum TargetKind {Leader,Router,Writer,+ Identity,/// The coordination store itself. Deliberately not part of the/// random-draw target pool: only the dedicated `EtcdBounce`/// scenario may touch it, under its own quorum guard.@@ -58,6 +59,7 @@ impl TargetKind {TargetKind::Leader => "leader",TargetKind::Router => "router",TargetKind::Writer => "writer",+ TargetKind::Identity => "identity",TargetKind::Etcd => "etcd",}}diff --git a/rust/personhog-test-harness/src/scenarios/traffic.rs b/rust/personhog-test-harness/src/scenarios/traffic.rsindex 574941ba8b06..d16802f5f4b7 100644--- a/rust/personhog-test-harness/src/scenarios/traffic.rs+++ b/rust/personhog-test-harness/src/scenarios/traffic.rs@@ -648,6 +648,7 @@ fn chaos_config(args: &TrafficArgs) -> ChaosConfig {target(TargetKind::Leader, &args.chaos_leader_namespace),target(TargetKind::Router, &args.chaos_router_namespace),target(TargetKind::Writer, &args.chaos_writer_namespace),+ target(TargetKind::Identity, &args.chaos_identity_namespace),],etcd: args.chaos_etcd_endpoints@@ -844,9 +845,8 @@ mod tests {store.revoke_lease(contender).await.unwrap();}- #[test]- fn vacuous_or_panicking_configurations_are_rejected() {- let valid = TrafficArgs {+ fn valid_args() -> TrafficArgs {+ TrafficArgs {chaos_etcd_namespace: None,router_url: "http://localhost:1".to_string(),identity_url: "http://localhost:2".to_string(),@@ -871,9 +871,54 @@ mod tests {chaos_leader_namespace: "personhog-leader".to_string(),chaos_router_namespace: "personhog-router-leader".to_string(),chaos_writer_namespace: "personhog-writer".to_string(),+ chaos_identity_namespace: "personhog-identity".to_string(),chaos_etcd_endpoints: None,chaos_etcd_prefix: "/personhog/".to_string(),- };+ }+ }++ #[test]+ fn chaos_draws_from_the_app_pods_of_every_service_class_and_never_etcd() {+ let cfg = chaos_config(&TrafficArgs {+ chaos_etcd_namespace: Some("etcd-ingestion".to_string()),+ ..valid_args()+ });+ let pool: Vec<(TargetKind, &str, &str)> = cfg+ .targets+ .iter()+ .map(|t| (t.kind, t.namespace.as_str(), t.selector.as_str()))+ .collect();+ assert_eq!(+ pool,+ [+ (+ TargetKind::Leader,+ "personhog-leader",+ "app.kubernetes.io/name=personhog-leader,app.kubernetes.io/component=app"+ ),+ (+ TargetKind::Router,+ "personhog-router-leader",+ "app.kubernetes.io/name=personhog-router-leader,app.kubernetes.io/component=app"+ ),+ (+ TargetKind::Writer,+ "personhog-writer",+ "app.kubernetes.io/name=personhog-writer,app.kubernetes.io/component=app"+ ),+ (+ TargetKind::Identity,+ "personhog-identity",+ "app.kubernetes.io/name=personhog-identity,app.kubernetes.io/component=app"+ ),+ ]+ );+ assert_eq!(cfg.etcd_target.map(|t| t.kind), Some(TargetKind::Etcd));+ }++ #[test]+ fn vacuous_or_panicking_configurations_are_rejected() {+ let valid = valid_args();assert!(validate_args(&valid).is_ok());// A disabled hostile lane is legal; zero traffic knobs are not.assert!(validate_args(&TrafficArgs {