Fix/mock relay live subscriptions#648
Conversation
📝 WalkthroughWalkthroughMockRelay's ChangesMockRelay Broadcast Suppression and Live Subscription Test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ndk/test/mocks/mock_relay_live_subscription_test.dart`:
- Around line 15-18: The test uses a fixed port by constructing MockRelay with
explicitPort: 4070 which can cause bind failures; update the setup where
mockRelay is created (the MockRelay instantiation assigned to mockRelay) to omit
explicitPort (or pass null/undefined per API) so MockRelay auto-allocates a free
port instead, ensuring parallel tests won't conflict.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b0f54742-2ad6-4c39-a6b4-c9f4958e7aa6
📒 Files selected for processing (2)
packages/ndk/test/mocks/mock_relay.dartpackages/ndk/test/mocks/mock_relay_live_subscription_test.dart
| mockRelay = MockRelay( | ||
| name: 'live-subscription-test-relay', | ||
| explicitPort: 4070, | ||
| ); |
There was a problem hiding this comment.
Avoid fixed port in integration test setup.
Using explicitPort: 4070 can cause intermittent bind failures under parallel test runs or when the port is occupied. Let MockRelay auto-allocate its test port.
Suggested change
mockRelay = MockRelay(
name: 'live-subscription-test-relay',
- explicitPort: 4070,
);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| mockRelay = MockRelay( | |
| name: 'live-subscription-test-relay', | |
| explicitPort: 4070, | |
| ); | |
| mockRelay = MockRelay( | |
| name: 'live-subscription-test-relay', | |
| ); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ndk/test/mocks/mock_relay_live_subscription_test.dart` around lines
15 - 18, The test uses a fixed port by constructing MockRelay with explicitPort:
4070 which can cause bind failures; update the setup where mockRelay is created
(the MockRelay instantiation assigned to mockRelay) to omit explicitPort (or
pass null/undefined per API) so MockRelay auto-allocates a free port instead,
ensuring parallel tests won't conflict.
Summary by CodeRabbit
Bug Fixes
Tests