Repository navigation
test(mqtt): fix env var race in topic_writer_tests - #299
Merged
Merged
Conversation
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BcQmgAzd8UMfUWiAFN4swa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the intermittent
test_topic_resolver_from_envfailure that broke the Comprehensive Development Check job in CI run #828 onmain:Root cause:
test_topic_resolver_with_connector_registrationalso set and removedTEST_MQTT_TOPIC, but never read it. Its resolver readsTEST_COMMAND_TOPIC. Cargo runs tests in parallel, so itsremove_varcould land between the other test'sset_varandvarcalls.Fix: remove the unused
set_var/remove_varsoTEST_MQTT_TOPICis only used by one test. The other env-mutating tests (TEST_INBOUND_TOPIC, KNXKNX_SWITCH_GROUP/KNX_SWITCH_INPUT) each use their own variable, so they don't have this problem.Related Issue
mainafter Zero-allocation connector boundary (design 054) #296)Checklist
cargo fmt --checkclean).cargo test -p aimdb-mqtt-connector --features "std,tokio-rustls" --test topic_writer_tests(17/17, run 5×). Fullmake checknot run locally.🤖 Generated with Claude Code
https://claude.ai/code/session_01BcQmgAzd8UMfUWiAFN4swa
Generated by Claude Code