Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Jun 18, 2025

This PR addresses the flakiness of test-message-type.js by ensuring that subscriptions are properly destroyed after each test execution.

  • Added node.destroySubscription(subscription) to each test callback following publisher.kill('SIGINT') to ensure a clean test environment.
  • Improves test reliability by explicitly cleaning up subscriptions in all message type tests.

Fix: #1170

@minggangw minggangw requested a review from Copilot June 18, 2025 04:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses the flakiness of test-message-type.js by ensuring that subscriptions are properly destroyed after each test execution.

  • Added node.destroySubscription(subscription) to each test callback following publisher.kill('SIGINT') to ensure a clean test environment.
  • Improves test reliability by explicitly cleaning up subscriptions in all message type tests.

'Bool_channel',
(msg) => {
publisher.kill('SIGINT');
node.destroySubscription(subscription);
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscription destruction logic is duplicated across multiple tests. Consider extracting this cleanup code into a common teardown hook (e.g., an afterEach block) to improve maintainability and reduce code duplication.

Suggested change
node.destroySubscription(subscription);
currentSubscription = { node, subscription };

Copilot uses AI. Check for mistakes.
@coveralls
Copy link

Coverage Status

coverage: 84.731%. remained the same
when pulling a576c68 on minggangw:fix-1170
into f631d46 on RobotWebTools:develop.

@minggangw minggangw merged commit 688791e into RobotWebTools:develop Jun 18, 2025
19 checks passed
minggangw added a commit that referenced this pull request Jun 18, 2025
This PR addresses the flakiness of test-message-type.js by ensuring that subscriptions are properly destroyed after each test execution.

- Added node.destroySubscription(subscription) to each test callback following publisher.kill('SIGINT') to ensure a clean test environment.  
- Improves test reliability by explicitly cleaning up subscriptions in all message type tests.

Fix: #1170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix flakiness of test-message-type.js

2 participants