Feat(testing) bus sequence expectations - #1657
Open
diiviikk5 wants to merge 2 commits into
Open
Conversation
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.
flowchart TD A[Test calls send_and_capture] --> B[MockAgentBus stores sender mode message] B --> C[Existing test logic continues] C --> D[Helper reads captured_messages] D --> E[sender_sequence] D --> F[mode_sequence] D --> G[sender_mode_sequence] E --> H[has_sender_sequence expected] F --> I[has_mode_sequence expected] G --> J[has_sender_mode_sequence expected] H --> K[Boolean assertion in test] I --> K J --> Kclosess #1656
What this PR does
This PR adds ordered sequence helpers to
MockAgentBusto make routing assertions cleaner in testing scenarios where message order matters.Added helpers
sender_sequence()mode_sequence()sender_mode_sequence()has_sender_sequence(&[&str])has_mode_sequence(&[CommunicationMode])has_sender_mode_sequence(&[(&str, CommunicationMode)])Added tests
New test file:
tests/tests/bus_sequence_expectation_tests.rsWhy this matters
This improves deterministic, readable assertions for multi-agent communication flows and supports stronger testing-framework ergonomics without clashing with existing formatter/export PRs.
Testing
cargo test -p mofa-testing --test bus_sequence_expectation_tests✅cargo test -p mofa-testingwas attempted but failed in this environment due compiler OOM/stack-overrun during unrelated test target compilation.