diff options
author | Krithic Kumar <30691152+notjedi@users.noreply.github.com> | 2024-03-18 10:59:47 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 13:29:47 +0800 |
commit | 1997bce393313d7ba685ee127d743e3a310530ac (patch) | |
tree | bf5190061ccba2e3ff8f703c39448b585f175ee0 /src/tests/fakes/fake_input.rs | |
parent | f892d2f758ea342ddbdb5d64eaed6e63fa8d1ddd (diff) |
feat: add `PID` column to `Process` table (#379)
* feat: add `PID` column to `Process` table
* fix(tests): populate fake data with the correct `ProcessInfo` type
* test: update snapshots
* refactor: use more idiomatic rust
* refactor: rename function from `get_proc_name` to `get_proc_info`
* refactor: only display PID when width available is highest
ref: https://github.com/imsnif/bandwhich/pull/165#issuecomment-620852892
* tests: update snapshots
* chore: update CHANGELOG
* fix: clippy warnings
* Revert "fix: clippy warnings"
This reverts commit e5f06cba1943d60b43a19957c42e3178c6916f69.
We will do this separately for the sake of keeping a clean history
* refactor: use `u32` for PID
* refactor: more idiomatic rust
---------
Co-authored-by: cyqsimon <28627918+cyqsimon@users.noreply.github.com>
Diffstat (limited to 'src/tests/fakes/fake_input.rs')
-rw-r--r-- | src/tests/fakes/fake_input.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tests/fakes/fake_input.rs b/src/tests/fakes/fake_input.rs index 146a85e..9f2fb80 100644 --- a/src/tests/fakes/fake_input.rs +++ b/src/tests/fakes/fake_input.rs @@ -16,6 +16,7 @@ use crate::{ dns::{self, Lookup}, Connection, Protocol, }, + os::ProcessInfo, OpenSockets, }; @@ -96,7 +97,7 @@ pub fn get_open_sockets() -> OpenSockets { 443, Protocol::Tcp, ), - String::from("1"), + ProcessInfo::new("1", 1), ); open_sockets.insert( Connection::new( @@ -105,7 +106,7 @@ pub fn get_open_sockets() -> OpenSockets { 4434, Protocol::Tcp, ), - String::from("4"), + ProcessInfo::new("4", 4), ); open_sockets.insert( Connection::new( @@ -114,7 +115,7 @@ pub fn get_open_sockets() -> OpenSockets { 4435, Protocol::Tcp, ), - String::from("5"), + ProcessInfo::new("5", 5), ); open_sockets.insert( Connection::new( @@ -123,7 +124,7 @@ pub fn get_open_sockets() -> OpenSockets { 4432, Protocol::Tcp, ), - String::from("2"), + ProcessInfo::new("2", 2), ); open_sockets.insert( Connection::new( @@ -132,12 +133,12 @@ pub fn get_open_sockets() -> OpenSockets { 443, Protocol::Tcp, ), - String::from("1"), + ProcessInfo::new("1", 1), ); let mut local_socket_to_procs = HashMap::new(); let mut connections = std::vec::Vec::new(); - for (connection, process_name) in open_sockets { - local_socket_to_procs.insert(connection.local_socket, process_name); + for (connection, proc_info) in open_sockets { + local_socket_to_procs.insert(connection.local_socket, proc_info); connections.push(connection); } |