Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disconnect cleanly from local MQTT broker in tedge connect #3025

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

reubenmiller
Copy link
Contributor

@reubenmiller reubenmiller commented Jul 30, 2024

Proposed changes

Send MQTT DISCONNECT on local MQTT connections (in normal operation) in the tedge connect and tedge reconnect commands.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@reubenmiller reubenmiller changed the title add system test to check presence of openssl errors due to missing DISCONNECT packet fix: add system test to check presence of openssl errors due to missing DISCONNECT packet Jul 30, 2024
@reubenmiller reubenmiller added theme:mqtt Theme: mqtt and mosquitto related topics theme:cli Theme: cli related topics labels Jul 30, 2024
@reubenmiller
Copy link
Contributor Author

reubenmiller commented Jul 30, 2024

First commit is to add the system test (Check absence of OpenSSL Error messages #3024) which should fail, and the second commit will be to fix the bug.

Copy link
Contributor

github-actions bot commented Jul 30, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
487 0 2 487 100 1h28m7.398575s

@reubenmiller reubenmiller changed the title fix: add system test to check presence of openssl errors due to missing DISCONNECT packet fix: disconnect cleanly from local MQTT broker Jul 30, 2024
@reubenmiller reubenmiller changed the title fix: disconnect cleanly from local MQTT broker fix: disconnect cleanly from local MQTT broker in tedge connect Jul 30, 2024
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 48 lines in your changes missing coverage. Please review.

Project coverage is 78.0%. Comparing base (d575685) to head (19e320d).
Report is 1 commits behind head on main.

Additional details and impacted files
Files Coverage Δ
crates/core/tedge/src/cli/connect/jwt_token.rs 39.8% <0.0%> (-4.8%) ⬇️
crates/core/tedge/src/cli/connect/command.rs 0.0% <0.0%> (ø)

... and 8 files with indirect coverage changes

@reubenmiller reubenmiller marked this pull request as ready for review July 30, 2024 16:16
Copy link
Contributor

@gligorisaev gligorisaev left a comment

Choose a reason for hiding this comment

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

The added test step is doing what is intended for

Copy link
Contributor

@gligorisaev gligorisaev left a comment

Choose a reason for hiding this comment

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

The added test was reviewed and it is passing

@Bravo555 Bravo555 self-requested a review July 31, 2024 11:47
Copy link
Contributor

@Bravo555 Bravo555 left a comment

Choose a reason for hiding this comment

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

Confirming that this patch fixes the problem.
Simple and sufficient for now, but another example of rumqttc API being a bit too verbose for our use case here. For a more elegant fix in the future, we should either use our mqtt-channel or create a wrapper over rumqttc::Client that at minimum provides a disconnect on drop.

@reubenmiller reubenmiller added this pull request to the merge queue Jul 31, 2024
Copy link
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

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

LGTM

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 31, 2024
@reubenmiller reubenmiller added this pull request to the merge queue Jul 31, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 31, 2024
@reubenmiller reubenmiller added this pull request to the merge queue Jul 31, 2024
Merged via the queue into thin-edge:main with commit e18db25 Jul 31, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:cli Theme: cli related topics theme:mqtt Theme: mqtt and mosquitto related topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants