From 9dc076105f94f69b4ad8925d456ba55f3f2392cf Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 20:13:56 +0000 Subject: [PATCH] test(mqtt): fix env var race in topic_writer_tests test_topic_resolver_with_connector_registration set and removed TEST_MQTT_TOPIC without ever reading it (its resolver reads TEST_COMMAND_TOPIC). Running in parallel with test_topic_resolver_from_env, the remove_var could land between that test's set_var and var calls, making it read None. This failed CI run #828 on main. Drop the unused set_var/remove_var so the variable has a single owner. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BcQmgAzd8UMfUWiAFN4swa --- aimdb-mqtt-connector/tests/topic_writer_tests.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/aimdb-mqtt-connector/tests/topic_writer_tests.rs b/aimdb-mqtt-connector/tests/topic_writer_tests.rs index 3f5e8b38..0938c0da 100644 --- a/aimdb-mqtt-connector/tests/topic_writer_tests.rs +++ b/aimdb-mqtt-connector/tests/topic_writer_tests.rs @@ -316,8 +316,6 @@ async fn test_topic_writer_with_connector_registration() { async fn test_topic_resolver_with_connector_registration() { let runtime = Arc::new(TokioAdapter::new().unwrap()); - std::env::set_var("TEST_MQTT_TOPIC", "commands/test/dynamic"); - let mut builder = AimDbBuilder::new().runtime(runtime).with_connector( aimdb_mqtt_connector::MqttConnector::new("mqtt://localhost:1883") .with_client_id("test-topic-resolver"), @@ -337,9 +335,6 @@ async fn test_topic_resolver_with_connector_registration() { // Build succeeds with connector registered assert!(builder.build().await.is_ok()); - - // Cleanup - std::env::remove_var("TEST_MQTT_TOPIC"); } #[tokio::test]