-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
MQTT metric unit tests part two #64
Merged
Merged
Conversation
This file contains 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
…ough refactoring of the MQTT target into separate modules, replacing the use of separate Tokio tasks and multiple uses of select with a single tokio::select! macro, and splitting connection state handling into a dedicated type.
…pl for select Either, replaced by use of tokio::select! instead.
…broker connection status.
…in MQTT connection processing loop out of the `run()` fn into new fn `do_run()` for better testability.
…and a connection refused test that tests the connection established/lost metrics showing that the new testability works.
… cancel safe but a task JoinHandle is. As the event loop is not movable across threads/tasks it and the client must be created in the event loop task and the client passed out for use by the parent code. Additional changes: - Use the concept of "active" MQTT connection rather than "conncted" as reconnection is handled transparently by the rumqttc event loop and thus we do not currently know if we are actually "connected" or not. - Introduce "mock poll result" suport for testing with particular good/bad output froms the MQTT event `poll()`ing fn. - Count connection errors detected in the MQTT event loop.- Fix the `connection_refused()` test using the new "mock poll result" and connection error counting functionality.
…and to support that allow connnection events and errors to be simulated _during_ a mock connection, not only specified up front. Also required adding a notion of ClientState to track the link between the client event loop.
…ion after connection re-establishment.
density215
approved these changes
Nov 23, 2023
density215
pushed a commit
that referenced
this pull request
Dec 8, 2023
This PR builds on and fixes some issues with PR #60. Primary change: - As the event loop is not movable across threads/tasks it and the client must be created in the event loop task and the client passed out for use by the parent code. Additionally: - Use the concept of "active" MQTT connection rather than "connected" as reconnection is handled transparently by the rumqttc event loop. - Introduce "mock poll result" support for testing with particular good/bad output froms the MQTT event `poll()`ing fn. - Count connection errors detected in the MQTT event loop. - Fix the `connection_refused()` test using the new "mock poll result" and connection error counting functionality. - Support dynamic reconfiguration (but currently not gracefully, unsent messages in the `rumqttc` internal queue will be dropped). - Fix the in-flight metric to use the `rumqttc` internal in-flight queue size. - Only terminate the `rumqttc` event loop on dynamic reconfiguration, allow it to persist during connection retry delays in order to send `rumqttc` internally queued messages on successful reconnection rather than lose them. - Add more unit tests.
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.
This PR builds on and fixes some issues with PR #60.
Primary change:
Additionally:
poll()
ing fn.connection_refused()
test using the new "mock poll result" and connection error counting functionality.rumqttc
internal queue will be dropped).rumqttc
internal in-flight queue size.rumqttc
event loop on dynamic reconfiguration, allow it to persist during connection retry delays in order to sendrumqttc
internally queued messages on successful reconnection rather than lose them.