-
Notifications
You must be signed in to change notification settings - Fork 3
Rewrite test framework #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [target.x86_64-unknown-linux-gnu] | ||
| runner = 'sudo' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| check: | ||
| cargo build; | ||
| env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="sudo" \ | ||
| cargo test -- --test-threads=1 --show-output $(WHAT) ; | ||
| cargo test -- --show-output; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,8 @@ impl CliColor { | |
| false | ||
| } | ||
| } else { | ||
| false | ||
| // iproute assume dark color if unknown | ||
| true | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,11 +134,7 @@ pub(crate) async fn handle_show( | |
|
|
||
| tokio::spawn(connection); | ||
|
|
||
| let mut link_get_handle = handle.link().get(); | ||
|
|
||
| if let Some(iface_name) = opts.first() { | ||
| link_get_handle = link_get_handle.match_name(iface_name.to_string()); | ||
| } | ||
| let link_get_handle = handle.link().get(); | ||
|
|
||
| let mut links = link_get_handle.execute(); | ||
| let mut ifaces: Vec<CliLinkInfo> = Vec::new(); | ||
|
|
@@ -150,6 +146,13 @@ pub(crate) async fn handle_show( | |
| resolve_controller_and_link_names(&mut ifaces); | ||
| resolve_netns_names(&mut ifaces).await?; | ||
|
|
||
| // In order to resolved interface index to interface name and netns name, | ||
| // we cannot use kernel side interface filter, but need to dump everything, | ||
| // then filter here | ||
| if let Some(iface_name) = opts.first() { | ||
| ifaces.retain(|i| i.ifname.as_str() == *iface_name); | ||
| } | ||
|
Comment on lines
+152
to
+154
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. This change moves the interface filtering from the kernel-side (
Member
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. Explained with comment. |
||
|
|
||
| Ok(ifaces) | ||
| } | ||
|
|
||
|
|
||
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.
The logic for handling
MultiBoolOptis repeated for each flag. This could be simplified by extracting it into a helper function to reduce code duplication and improve readability.For example, you could introduce a helper function like this:
And then use it like so: