Repository navigation
Let tests take their DDS domain from RUSTDDS_TEST_DOMAIN_ID - #448
Merged
jhelovuo merged 1 commit intoOct 16, 2026
Merged
Conversation
The tests create their DomainParticipants on fixed domain ids, most of them on domain 0. On a developer machine that shares a network with other DDS systems, a test run therefore joins those systems' domain 0. They discover the short-lived test participants and try to send to the addresses these advertise. RUSTDDS_TEST_DOMAIN_ID now sets a base that is added to the domain id of each test participant. Unset or empty means 0, so without the variable each test uses the same domain as before and CI is unchanged. Each test keeps its current id as an offset (0, or 11, 51 and 52 for the tests that keep apart from the others), so the tests stay on separate domains after the shift. The unit tests that send raw packets to the ports of domains 5, 12, 14, 15 and 16 shift those domains the same way, so they stay off the ports of the shifted participants. A value that is not a u16, or that is above 147, fails the test with a message: the highest test domain, 147 + 52, stays below the lock-order test's scratch domains (200-229). The helper is in src/test/test_domain.rs, which the integration tests include through tests/common/mod.rs. Not moved: the lock-order test's scratch domains, examples/, and the doc examples, which still create their participants on domain 0. `cargo test --tests` leaves the doc tests out. Assisted-by: Claude Fable 5.1 Assisted-by: OpenAI Codex (gpt-6-astra)
Member
|
Thank you! |
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.
The tests create their DomainParticipants on fixed domain ids, most on
domain 0. On a machine that shares a network with other DDS systems,
cargo testjoins their domain 0; a robot on my network discovered thetest participants, could not reach the addresses they advertised, and
logged a failed send per sample.
RUSTDDS_TEST_DOMAIN_IDnow sets a base added to the domain id of eachtest participant. Unset or empty means 0, so CI is unchanged. Tests keep
their current id as an offset (0, or 11, 51, 52 for the ones that stay
apart), so they remain on separate domains after the shift. A value that
is not a u16, or above 147, fails the test with a message naming the
variable; 147 keeps the highest test domain (147 + 52) below the
lock-order test's scratch domains 200-229.
src/test/test_domain.rs: the helper and parser, included by theintegration tests through
tests/common/mod.rs.derive their fixed ports from the test domain too: the ports of domains
5, 12, 14, 15 and 16 shift with the participants and stay off their
ports, and 7412 (participant 1's discovery port) moves to the shifted
domain.
domain 0, so plain
cargo teststill joins domain 0;cargo test --testsleaves them out. Letting the doc examples read the variabletoo would change the rendered examples, so that is left as a possible
follow-up.
tests/lock_order_discovery_db.rs, which already picks itsown scratch domains (200-229, never 0) and passes them to its child
through
RUSTDDS_LOCK_ORDER_DOMAIN; and the programs inexamples/,which are not tests.
test_domain_id(47).Validation (macOS):
cargo test --tests -- --test-threads=1without thevariable and with 12, 14, 16, 42 and 147 (694 unit, 2 + 2 integration
tests), with 42 also with
--features securityand--features mio_08,all green; 148 and
abcfail with the message;cargo test --doc(58)green;
lsofduring the run with 14 showed no port of domain 0 open;cargo clippy --all-targetsandcargo +nightly fmt --checkclean.Developed with assistance from Claude Fable 5.1 and OpenAI Codex (gpt-6-astra).