Skip to content

Commit

Permalink
Fix client state test cleanup (#1864)
Browse files Browse the repository at this point in the history
Closes #1862
<!-- These comments should help create a useful PR message, please
delete any remaining comments before opening the PR. -->
<!-- If there is no issue number make sure to describe clearly *why*
this PR is necessary. -->
<!-- Mention open questions, remaining TODOs, if any -->

### This PR:
<!-- Describe what this PR adds to this repo and why -->
<!-- E.g. -->
<!-- * Implements feature 1 -->
<!-- * Fixes bug 3 -->
Adds a cleanup step to the
`test_process_client_handling_stream_request_latest_voters_snapshot`
function in order to ensure that a `panic!` can be avoided in the test
cleanup.

<!-- ### This PR does not: -->
<!-- Describe what is out of scope for this PR, if applicable. Leave
this section blank if it's not applicable -->
<!-- This section helps avoid the reviewer having to needlessly point
out missing parts -->
<!-- * Implement feature 3 because that feature is blocked by Issue 4
-->
<!-- * Implement xyz because that is tracked in issue #123. -->
<!-- * Address xzy for which I opened issue #456 -->

<!-- ### Key places to review: -->
<!-- Describe key places for reviewers to pay close attention to -->
<!-- * file.rs, `add_integers` function -->
<!-- Or directly comment on those files/lines to make it easier for the
reviewers -->

<!-- ### How to test this PR:  -->
<!-- Optional, uncomment the above line if this is relevant to your PR
-->
<!-- If your PR is fully tested through CI there is no need to add this
section -->
<!-- * E.g. `just test` -->

<!-- ### Things tested -->
<!-- Anything that was manually tested (that is not tested in CI). -->
<!-- E.g. building/running of docker containers. Changes to docker demo,
... -->
<!-- Especially mention anything untested, with reasoning and link an
issue to resolve this. -->

<!-- Complete the following items before creating this PR -->
<!-- [ ] Issue linked or PR description mentions why this change is
necessary. -->
<!-- [ ] PR description is clear enough for reviewers. -->
<!-- [ ] Documentation for changes (additions) has been updated (added).
-->
<!-- [ ] If this is a draft it is marked as "draft".  -->

<!-- To make changes to this template edit
https://github.com/EspressoSystems/.github/blob/main/PULL_REQUEST_TEMPLATE.md
-->
  • Loading branch information
Ayiga authored Aug 14, 2024
2 parents c408e5e + 68060a4 commit 036d0a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion node-metrics/src/service/client_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ pub mod tests {
let (internal_client_message_sender, internal_client_message_receiver) = mpsc::channel(1);
let (server_message_sender_1, mut server_message_receiver_1) = mpsc::channel(1);
let (server_message_sender_2, mut server_message_receiver_2) = mpsc::channel(1);
let _process_internal_client_message_handle = InternalClientMessageProcessingTask::new(
let mut process_internal_client_message_handle = InternalClientMessageProcessingTask::new(
internal_client_message_receiver,
data_state,
client_thread_state,
Expand Down Expand Up @@ -1359,6 +1359,10 @@ pub mod tests {
voters_1, voters_2
]))),
);

if let Some(task_handle) = process_internal_client_message_handle.task_handle.take() {
assert_eq!(task_handle.cancel().await, None);
}
}

#[async_std::test]
Expand Down

0 comments on commit 036d0a9

Please sign in to comment.