-
Notifications
You must be signed in to change notification settings - Fork 254
test: ensure temporary directories are cleaned up after tests #5163
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
Open
jetjinser
wants to merge
2
commits into
nervosnetwork:develop
Choose a base branch
from
jetjinser:4177
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| use crate::utils::TempPathBuf; | ||
| use crate::{Spec, utils::nodes_panicked}; | ||
| use ckb_channel::{Receiver, Sender, unbounded}; | ||
| use ckb_logger::{error, info}; | ||
|
|
@@ -24,18 +25,20 @@ pub enum Notify { | |
| Done { | ||
| spec_name: String, | ||
| seconds: u64, | ||
| node_paths: Vec<PathBuf>, | ||
| node_paths: Vec<TempPathBuf>, | ||
| }, | ||
| Error { | ||
| spec_error: Box<dyn Any + Send>, | ||
| spec_name: String, | ||
| seconds: u64, | ||
| node_log_paths: Vec<PathBuf>, | ||
| node_paths: Vec<TempPathBuf>, | ||
| }, | ||
| Panick { | ||
| spec_name: String, | ||
| seconds: u64, | ||
| node_log_paths: Vec<PathBuf>, | ||
| node_paths: Vec<TempPathBuf>, | ||
| }, | ||
| Stop, | ||
| } | ||
|
|
@@ -163,9 +166,10 @@ impl Worker { | |
| .unwrap(); | ||
|
|
||
| let mut nodes = spec.before_run(); | ||
| // Used to extend the lifecycle of TempPathBuf | ||
| let node_paths = nodes | ||
| .iter() | ||
| .map(|node| node.working_dir()) | ||
| .map(|node| node.owned_working_dir()) | ||
|
Comment on lines
+169
to
+172
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the reason for the changes to the |
||
| .collect::<Vec<_>>(); | ||
| let node_log_paths = nodes.iter().map(|node| node.log_path()).collect::<Vec<_>>(); | ||
| let result = panic::catch_unwind(panic::AssertUnwindSafe(|| { | ||
|
|
@@ -184,6 +188,7 @@ impl Worker { | |
| spec_name: spec.name().to_string(), | ||
| seconds: now.elapsed().as_secs(), | ||
| node_log_paths, | ||
| node_paths, | ||
| }) | ||
| .unwrap(); | ||
| } else if let Some(spec_error) = spec_error { | ||
|
|
@@ -193,6 +198,7 @@ impl Worker { | |
| spec_name: spec.name().to_string(), | ||
| seconds: now.elapsed().as_secs(), | ||
| node_log_paths, | ||
| node_paths, | ||
| }) | ||
| .unwrap(); | ||
| } else { | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling
ckb_stop_handler::broadcast_exit_signals()inRpcTestSuite'sDropwill cancel the global stop token for the entire test process and cannot be reset. Since many RPC tests create and drop their ownRpcTestSuite, this risks prematurely stopping services in other tests (including tests that run after the first one), leading to flakiness or failures. Prefer an explicit, suite-local shutdown mechanism (e.g., stop/join the services started insetup_rpc_test_suite) or ensure the broadcast is performed once at the very end of the whole test binary rather than on every suite drop.