From d9cc84b3732fe9cb0c819b93d67d2a6420f6a065 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:29:47 +0800 Subject: [PATCH] Partially fix flaky tests (#308) * Minor code style changes * Disable rendering of timestamps in tests * Update test snapshots * Test everything with insta macros (no more `assert(_eq)?`) - This has the benefit of creating snapshots for everything, allowing for later diffing * Don't use `assert_debug_snapshot` for large string outputs - This makes snapshots more human-inspectable * Code style improvement on two tests - `pause_by_space` - `rearranged_by_tab` * Minor code style improvements --- Cargo.lock | 1 + Cargo.toml | 1 + src/display/components/header_details.rs | 68 ++-- src/display/ui.rs | 27 +- ...ests__cases__ui__basic_only_addresses.snap | 2 +- ...ts__cases__ui__basic_only_connections.snap | 2 +- ...ests__cases__ui__basic_only_processes.snap | 2 +- ..._ui__basic_processes_with_dns_queries.snap | 2 +- ...hich__tests__cases__ui__basic_startup.snap | 2 +- ...__cases__ui__bi_directional_traffic-2.snap | 64 +--- ...__cases__ui__bi_directional_traffic-3.snap | 15 - ...ts__cases__ui__bi_directional_traffic.snap | 54 ++- ...l-width-under-30-height-draw_events-1.snap | 34 -- ...ll-width-under-30-height-draw_events.snap} | 64 ++-- ...r-120-width-full-height-draw_events-1.snap | 55 --- ...er-120-width-full-height-draw_events.snap} | 54 ++- ...0-width-under-30-height-draw_events-1.snap | 34 -- ...20-width-under-30-height-draw_events.snap} | 33 +- ...0-width-under-50-height-draw_events-1.snap | 55 --- ...50-width-under-50-height-draw_events.snap} | 54 ++- ...0-width-under-30-height-draw_events-0.snap | 34 -- ...0-width-under-30-height-draw_events-1.snap | 34 -- ...70-width-under-30-height-draw_events.snap} | 91 +++-- ...ple_connections_from_remote_address-2.snap | 64 +--- ...ple_connections_from_remote_address-3.snap | 15 - ...tiple_connections_from_remote_address.snap | 54 ++- ..._traffic_from_different_connections-2.snap | 64 +--- ..._traffic_from_different_connections-3.snap | 15 - ...of_traffic_from_different_connections.snap | 54 ++- ...s_of_traffic_from_single_connection-2.snap | 64 +--- ...s_of_traffic_from_single_connection-3.snap | 15 - ...ets_of_traffic_from_single_connection.snap | 54 ++- ...processes_with_multiple_connections-2.snap | 64 +--- ...processes_with_multiple_connections-3.snap | 15 - ...e_processes_with_multiple_connections.snap | 54 ++- ...__tests__cases__ui__no_resolve_mode-2.snap | 67 +--- ...__tests__cases__ui__no_resolve_mode-3.snap | 18 - ...ch__tests__cases__ui__no_resolve_mode.snap | 106 +++++- ...s__cases__ui__one_packet_of_traffic-2.snap | 64 +--- ...s__cases__ui__one_packet_of_traffic-3.snap | 15 - ...sts__cases__ui__one_packet_of_traffic.snap | 54 ++- ...e_process_with_multiple_connections-2.snap | 64 +--- ...e_process_with_multiple_connections-3.snap | 15 - ...one_process_with_multiple_connections.snap | 54 ++- ...h__tests__cases__ui__pause_by_space-2.snap | 67 +--- ...h__tests__cases__ui__pause_by_space-3.snap | 55 --- ...h__tests__cases__ui__pause_by_space-4.snap | 18 - ...ich__tests__cases__ui__pause_by_space.snap | 106 +++++- ...tests__cases__ui__rearranged_by_tab-2.snap | 73 ++-- ...tests__cases__ui__rearranged_by_tab-3.snap | 55 --- ...tests__cases__ui__rearranged_by_tab-5.snap | 55 --- ...tests__cases__ui__rearranged_by_tab-6.snap | 24 -- ...__tests__cases__ui__rearranged_by_tab.snap | 210 ++++++++++- ...ned_traffic_from_multiple_processes-2.snap | 67 +--- ...ned_traffic_from_multiple_processes-3.snap | 18 - ...ained_traffic_from_multiple_processes.snap | 106 +++++- ...m_multiple_processes_bi_directional-2.snap | 67 +--- ...m_multiple_processes_bi_directional-3.snap | 18 - ...rom_multiple_processes_bi_directional.snap | 106 +++++- ...iple_processes_bi_directional_total-2.snap | 67 +--- ...iple_processes_bi_directional_total-3.snap | 18 - ...ltiple_processes_bi_directional_total.snap | 108 +++++- ...affic_from_multiple_processes_total-2.snap | 67 +--- ...affic_from_multiple_processes_total-3.snap | 18 - ...traffic_from_multiple_processes_total.snap | 108 +++++- ..._sustained_traffic_from_one_process-2.snap | 67 +--- ..._sustained_traffic_from_one_process-3.snap | 18 - ...i__sustained_traffic_from_one_process.snap | 106 +++++- ...ined_traffic_from_one_process_total-2.snap | 67 +--- ...ined_traffic_from_one_process_total-3.snap | 18 - ...tained_traffic_from_one_process_total.snap | 108 +++++- ..._cases__ui__traffic_with_host_names-2.snap | 67 +--- ..._cases__ui__traffic_with_host_names-3.snap | 18 - ...s__cases__ui__traffic_with_host_names.snap | 106 +++++- ...cases__ui__traffic_with_winch_event-2.snap | 67 +--- ...cases__ui__traffic_with_winch_event-3.snap | 55 --- ...cases__ui__traffic_with_winch_event-4.snap | 18 - ...__cases__ui__traffic_with_winch_event.snap | 106 +++++- ..._cases__ui__truncate_long_hostnames-2.snap | 67 +--- ..._cases__ui__truncate_long_hostnames-3.snap | 18 - ...s__cases__ui__truncate_long_hostnames.snap | 106 +++++- ...ses__ui__two_packets_only_addresses-2.snap | 55 --- ...cases__ui__two_packets_only_addresses.snap | 54 ++- ...s__ui__two_packets_only_connections-2.snap | 55 --- ...ses__ui__two_packets_only_connections.snap | 54 ++- ...ses__ui__two_packets_only_processes-2.snap | 55 --- ...cases__ui__two_packets_only_processes.snap | 54 ++- ...s__ui__two_windows_split_horizontally.snap | 54 ++- ...ses__ui__two_windows_split_vertically.snap | 2 +- src/tests/cases/test_utils.rs | 28 +- src/tests/cases/ui.rs | 333 +++++++++--------- 91 files changed, 2680 insertions(+), 2278 deletions(-) delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-1.snap rename src/tests/cases/snapshots/{bandwhich__tests__cases__ui__rearranged_by_tab-4.snap => bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap} (53%) delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-1.snap rename src/tests/cases/snapshots/{bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-0.snap => bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap} (53%) delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-1.snap rename src/tests/cases/snapshots/{bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-0.snap => bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events.snap} (52%) delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-1.snap rename src/tests/cases/snapshots/{bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-0.snap => bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events.snap} (53%) delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-0.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-1.snap rename src/tests/cases/snapshots/{bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-0.snap => bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events.snap} (54%) delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-4.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-5.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-6.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-4.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-3.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses-2.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections-2.snap delete mode 100644 src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes-2.snap diff --git a/Cargo.lock b/Cargo.lock index f0388a58d..eb17e8b7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -155,6 +155,7 @@ dependencies = [ "http_req", "insta", "ipnetwork", + "itertools", "log", "netstat2", "packet-builder", diff --git a/Cargo.toml b/Cargo.toml index bf538e4fc..359e2488e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,6 +53,7 @@ insta = "1.34.0" pnet_base = "0.34.0" packet-builder = { version = "0.7.0", git = "https://github.com/cyqsimon/packet_builder.git", branch = "patch-update" } rstest = "0.18.2" +itertools = "0.11.0" [target.'cfg(target_os="windows")'.build-dependencies] anyhow = "1.0.75" diff --git a/src/display/components/header_details.rs b/src/display/components/header_details.rs index 2c32a18dc..e9974062d 100644 --- a/src/display/components/header_details.rs +++ b/src/display/components/header_details.rs @@ -8,17 +8,10 @@ use ratatui::{ text::Span, widgets::Paragraph, }; +use unicode_width::UnicodeWidthStr; use crate::display::{DisplayBandwidth, UIState}; -const SECONDS_IN_DAY: u64 = 86400; - -pub struct HeaderDetails<'a> { - pub state: &'a UIState, - pub elapsed_time: std::time::Duration, - pub paused: bool, -} - pub fn elapsed_time(last_start_time: Instant, cumulative_time: Duration, paused: bool) -> Duration { if paused { cumulative_time @@ -27,27 +20,46 @@ pub fn elapsed_time(last_start_time: Instant, cumulative_time: Duration, paused: } } +fn format_duration(d: Duration) -> String { + let s = d.as_secs(); + let days = match s / 86400 { + 0 => "".to_string(), + 1 => "1 day, ".to_string(), + n => format!("{n} days, "), + }; + format!( + "{days}{:02}:{:02}:{:02}", + (s / 3600) % 24, + (s / 60) % 60, + s % 60, + ) +} + +pub struct HeaderDetails<'a> { + pub state: &'a UIState, + pub elapsed_time: Duration, + pub paused: bool, +} + impl<'a> HeaderDetails<'a> { - #[allow(clippy::int_plus_one)] pub fn render(&self, frame: &mut Frame, rect: Rect) { let bandwidth = self.bandwidth_string(); - let mut elapsed_time = None; - let print_elapsed_time = if self.state.cumulative_mode { - elapsed_time = Some(self.elapsed_time_string()); - bandwidth.len() + elapsed_time.as_ref().unwrap().len() + 1 <= rect.width as usize - } else { - false - }; - let color = if self.paused { Color::Yellow } else { Color::Green }; - if print_elapsed_time { - self.render_elapsed_time(frame, rect, elapsed_time.as_ref().unwrap(), color); + // do not render time in tests, otherwise the output becomes non-deterministic + // see: https://github.com/imsnif/bandwhich/issues/303 + if cfg!(not(test)) && self.state.cumulative_mode { + let elapsed_time = format_duration(self.elapsed_time); + // only render if there is enough width + if bandwidth.width() + 1 + elapsed_time.width() <= rect.width as usize { + self.render_elapsed_time(frame, rect, &elapsed_time, color); + } } + self.render_bandwidth(frame, rect, &bandwidth, color); } @@ -97,22 +109,4 @@ impl<'a> HeaderDetails<'a> { let paragraph = Paragraph::new(elapsed_time_text).alignment(Alignment::Right); frame.render_widget(paragraph, rect); } - - fn days_string(&self) -> String { - match self.elapsed_time.as_secs() / SECONDS_IN_DAY { - 0 => "".to_string(), - 1 => "1 day, ".to_string(), - n => format!("{n} days, "), - } - } - - fn elapsed_time_string(&self) -> String { - format!( - "{}{:02}:{:02}:{:02} ", - self.days_string(), - (self.elapsed_time.as_secs() % SECONDS_IN_DAY) / 3600, - (self.elapsed_time.as_secs() % 3600) / 60, - self.elapsed_time.as_secs() % 60 - ) - } } diff --git a/src/display/ui.rs b/src/display/ui.rs index 3241b0ba2..00532e2b2 100644 --- a/src/display/ui.rs +++ b/src/display/ui.rs @@ -123,24 +123,17 @@ where } pub fn draw(&mut self, paused: bool, show_dns: bool, elapsed_time: Duration, ui_offset: usize) { - let state = &self.state; - let children = self.get_tables_to_display(); + let layout = Layout { + header: HeaderDetails { + state: &self.state, + elapsed_time, + paused, + }, + children: self.get_tables_to_display(), + footer: HelpText { paused, show_dns }, + }; self.terminal - .draw(|frame| { - let size = frame.size(); - let total_bandwidth = HeaderDetails { - state, - elapsed_time, - paused, - }; - let help_text = HelpText { paused, show_dns }; - let layout = Layout { - header: total_bandwidth, - children, - footer: help_text, - }; - layout.render(frame, size, ui_offset); - }) + .draw(|frame| layout.render(frame, frame.size(), ui_offset)) .unwrap(); } diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap index b6057c35a..7dfb89c53 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by remote address───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap index d58004157..ce0e15ae6 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap index 60bee0fdf..74471af92 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap index bc15814f3..d112db05d 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap index d60e59734..3244791a6 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-2.snap index 20924f97f..723b4bc76 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-2.snap @@ -1,55 +1,15 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 24Bps / 25Bps - - - 1 1 24Bps / 25Bps 1.1.1.1 1 24Bps / 25Bps - - - - - - - - - - - - - - - - - - - - - - - - :443 => 1.1.1.1:12345 (tcp) 1 24Bps / 25Bps - - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-3.snap deleted file mode 100644 index 723b4bc76..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic-3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap index d60e59734..4ddabc7e7 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 24Bps / 25Bps + + + 1 1 24Bps / 25Bps 1.1.1.1 1 24Bps / 25Bps + + + + + + + + + + + + + + + + + + + + + + + + :443 => 1.1.1.1:12345 (tcp) 1 24Bps / 25Bps + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-1.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-1.snap deleted file mode 100644 index 9c60b3257..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-1.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 98Bps - - - 5 1 0Bps / 28Bps 3.3.3.3 1 0Bps / 28Bps - 4 1 0Bps / 26Bps 2.2.2.2 1 0Bps / 26Bps - 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps - 2 1 0Bps / 21Bps 4.4.4.4 1 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-4.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap similarity index 53% rename from src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-4.snap rename to src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap index 2a693a55d..3a2696aa9 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-4.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap @@ -1,35 +1,45 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[3]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - 14 - - - 14 14 - - - - - - - - - - - - - - - - - - - - - + Total Up / Down: 0Bps / 0Bps +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 98Bps - 14 + 5 1 0Bps / 28Bps 3.3.3.3 1 0Bps / 28Bps + 4 1 0Bps / 26Bps 2.2.2.2 1 0Bps / 26Bps + 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps + 2 1 0Bps / 21Bps 4.4.4.4 1 0Bps / 21Bps diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-1.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-1.snap deleted file mode 100644 index 8230e66a5..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-1.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 98Bps - - - 5 1 0Bps / 28Bps - 4 1 0Bps / 26Bps - 1 1 0Bps / 22Bps - 2 1 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - - 3.3.3.3 1 0Bps / 28Bps - 2.2.2.2 1 0Bps / 26Bps - 1.1.1.1 1 0Bps / 22Bps - 4.4.4.4 1 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-0.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap similarity index 53% rename from src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-0.snap rename to src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap index 53043a7ca..b0ef8e16a 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events-0.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────────────────────────────┐ @@ -53,3 +53,55 @@ expression: "&terminal_draw_events_mirror[0]" └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). +--- SECTION SEPARATOR --- + 98Bps + + + 5 1 0Bps / 28Bps + 4 1 0Bps / 26Bps + 1 1 0Bps / 22Bps + 2 1 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + + 3.3.3.3 1 0Bps / 28Bps + 2.2.2.2 1 0Bps / 26Bps + 1.1.1.1 1 0Bps / 22Bps + 4.4.4.4 1 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-1.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-1.snap deleted file mode 100644 index 06cb64583..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-1.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 98Bps - - - 5 1 0Bps / 28Bps - 4 1 0Bps / 26Bps - 1 1 0Bps / 22Bps - 2 1 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-0.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events.snap similarity index 52% rename from src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-0.snap rename to src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events.snap index 0bbc796b9..04276addd 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events-0.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────────────────────────────┐ @@ -31,4 +31,35 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 98Bps + + + 5 1 0Bps / 28Bps + 4 1 0Bps / 26Bps + 1 1 0Bps / 22Bps + 2 1 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-1.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-1.snap deleted file mode 100644 index 8e7dbcbc5..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-1.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 98Bps - - - 5 0Bps / 28Bps - 4 0Bps / 26Bps - 1 0Bps / 22Bps - 2 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - - 3.3.3.3 0Bps / 28Bps - 2.2.2.2 0Bps / 26Bps - 1.1.1.1 0Bps / 22Bps - 4.4.4.4 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-0.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events.snap similarity index 53% rename from src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-0.snap rename to src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events.snap index b0c714396..e198f1f09 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events-0.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name─────────────────────┐ @@ -53,3 +53,55 @@ expression: "&terminal_draw_events_mirror[0]" └────────────────────────────────────────────────┘ Press to pause. +--- SECTION SEPARATOR --- + 98Bps + + + 5 0Bps / 28Bps + 4 0Bps / 26Bps + 1 0Bps / 22Bps + 2 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + + 3.3.3.3 0Bps / 28Bps + 2.2.2.2 0Bps / 26Bps + 1.1.1.1 0Bps / 22Bps + 4.4.4.4 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-0.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-0.snap deleted file mode 100644 index 281674ae6..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-0.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" ---- - Total Up / Down: 0Bps / 0Bps -┌Utilization by process name────────────────────────────────────────┐ -│Process Connections Up / Down │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -└───────────────────────────────────────────────────────────────────┘ - Press to pause. Use to rearrange tables. - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-1.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-1.snap deleted file mode 100644 index 6f24434f5..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events-1.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 98Bps - - - 5 1 0Bps / 28Bps - 4 1 0Bps / 26Bps - 1 1 0Bps / 22Bps - 2 1 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-0.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events.snap similarity index 54% rename from src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-0.snap rename to src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events.snap index 1e26e228d..84d97182d 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events-0.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events.snap @@ -1,34 +1,65 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps -┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ -│Process Connections Up / Down ││Remote Address Connections Up / Down │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -│ ││ │ -└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ - Press to pause. Use to rearrange tables. (DNS queries hidden). + Total Up / Down: 0Bps / 0Bps +┌Utilization by process name────────────────────────────────────────┐ +│Process Connections Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└───────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. + +--- SECTION SEPARATOR --- + 98Bps + + + 5 1 0Bps / 28Bps + 4 1 0Bps / 26Bps + 1 1 0Bps / 22Bps + 2 1 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-2.snap index 0d13a7efb..723b4bc76 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-2.snap @@ -1,55 +1,15 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 47Bps - - - 1 2 0Bps / 47Bps 1.1.1.1 2 0Bps / 47Bps - - - - - - - - - - - - - - - - - - - - - - - - :443 => 1.1.1.1:12346 (tcp) 1 0Bps / 25Bps - :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-3.snap deleted file mode 100644 index 723b4bc76..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address-3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address.snap index d60e59734..6f8006dee 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 47Bps + + + 1 2 0Bps / 47Bps 1.1.1.1 2 0Bps / 47Bps + + + + + + + + + + + + + + + + + + + + + + + + :443 => 1.1.1.1:12346 (tcp) 1 0Bps / 25Bps + :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-2.snap index ce8e2699a..723b4bc76 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-2.snap @@ -1,55 +1,15 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 41Bps - - - 1 1 0Bps / 22Bps 2.2.2.2 2 0Bps / 41Bps - 4 1 0Bps / 19Bps - - - - - - - - - - - - - - - - - - - - - - - :443 => 2.2.2.2:12345 (tcp) 1 0Bps / 22Bps - :4434 => 2.2.2.2:54321 (tcp) 4 0Bps / 19Bps - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-3.snap deleted file mode 100644 index 723b4bc76..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections-3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections.snap index d60e59734..38cecf140 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 41Bps + + + 1 1 0Bps / 22Bps 2.2.2.2 2 0Bps / 41Bps + 4 1 0Bps / 19Bps + + + + + + + + + + + + + + + + + + + + + + + :443 => 2.2.2.2:12345 (tcp) 1 0Bps / 22Bps + :4434 => 2.2.2.2:54321 (tcp) 4 0Bps / 19Bps + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-2.snap index 344a6ac85..723b4bc76 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-2.snap @@ -1,55 +1,15 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 45Bps - - - 1 1 0Bps / 45Bps 1.1.1.1 1 0Bps / 45Bps - - - - - - - - - - - - - - - - - - - - - - - - :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 45Bps - - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-3.snap deleted file mode 100644 index 723b4bc76..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection-3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection.snap index d60e59734..86dff1bf5 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 45Bps + + + 1 1 0Bps / 45Bps 1.1.1.1 1 0Bps / 45Bps + + + + + + + + + + + + + + + + + + + + + + + + :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 45Bps + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-2.snap index 9e55903cc..723b4bc76 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-2.snap @@ -1,55 +1,15 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 98Bps - - - 5 1 0Bps / 28Bps 3.3.3.3 1 0Bps / 28Bps - 4 1 0Bps / 26Bps 2.2.2.2 1 0Bps / 26Bps - 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps - 2 1 0Bps / 21Bps 4.4.4.4 1 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - - :4435 => 3.3.3.3:1337 (tcp) 5 0Bps / 28Bps - :4434 => 2.2.2.2:54321 (tcp) 4 0Bps / 26Bps - :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps - :4432 => 4.4.4.4:1337 (tcp) 2 0Bps / 21Bps - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-3.snap deleted file mode 100644 index 723b4bc76..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections-3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections.snap index d60e59734..dd51d80ba 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -53,3 +53,55 @@ expression: "&terminal_draw_events_mirror[0]" └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). +--- SECTION SEPARATOR --- + 98Bps + + + 5 1 0Bps / 28Bps 3.3.3.3 1 0Bps / 28Bps + 4 1 0Bps / 26Bps 2.2.2.2 1 0Bps / 26Bps + 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps + 2 1 0Bps / 21Bps 4.4.4.4 1 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + + :4435 => 3.3.3.3:1337 (tcp) 5 0Bps / 28Bps + :4434 => 2.2.2.2:54321 (tcp) 4 0Bps / 26Bps + :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps + :4432 => 4.4.4.4:1337 (tcp) 2 0Bps / 21Bps + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-2.snap index 5704676d4..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" +expression: terminal_events.lock().unwrap().as_slice() --- - 53 60 - - - 31 2 31 2 - 22 27 22 27 - - - - - - - - - - - - - - - - - - - - - - - 31 2 - 22 27 - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode.snap index 21308720f..05198bf10 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode.snap @@ -1,7 +1,59 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- + Total Up / Down: 0Bps / 0Bps +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- 45Bps / 49Bps @@ -51,5 +103,57 @@ expression: "&terminal_draw_events_mirror[1]" + + +--- SECTION SEPARATOR --- + 53 60 + + + 31 2 31 2 + 22 27 22 27 + + + + + + + + + + + + + + + + + + + + + + + 31 2 + 22 27 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-2.snap index 8552ae7d7..723b4bc76 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-2.snap @@ -1,55 +1,15 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 21Bps / 0Bps - - - 1 1 21Bps / 0Bps 1.1.1.1 1 21Bps / 0Bps - - - - - - - - - - - - - - - - - - - - - - - - :443 => 1.1.1.1:12345 (tcp) 1 21Bps / 0Bps - - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-3.snap deleted file mode 100644 index 723b4bc76..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic-3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic.snap index d60e59734..44c8715c6 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 21Bps / 0Bps + + + 1 1 21Bps / 0Bps 1.1.1.1 1 21Bps / 0Bps + + + + + + + + + + + + + + + + + + + + + + + + :443 => 1.1.1.1:12345 (tcp) 1 21Bps / 0Bps + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-2.snap index bc98fea9f..723b4bc76 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-2.snap @@ -1,55 +1,15 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 46Bps - - - 1 2 0Bps / 46Bps 1.1.1.1 2 0Bps / 46Bps - - - - - - - - - - - - - - - - - - - - - - - - :443 => 1.1.1.1:12346 (tcp) 1 0Bps / 24Bps - :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-3.snap deleted file mode 100644 index 723b4bc76..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections-3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections.snap index d60e59734..65db5a712 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 46Bps + + + 1 2 0Bps / 46Bps 1.1.1.1 2 0Bps / 46Bps + + + + + + + + + + + + + + + + + + + + + + + + :443 => 1.1.1.1:12346 (tcp) 1 0Bps / 24Bps + :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-2.snap index 84811684e..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - Total Up / Down: 0Bps / 0Bps [PAUSED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - resume. Use to rea range tables. (DNS queries hi den). - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-3.snap deleted file mode 100644 index d710afbc2..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-3.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-4.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-4.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space-4.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space.snap index d60e59734..a904ba9a7 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,108 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + Total Up / Down: 0Bps / 0Bps [PAUSED] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + resume. Use to rea range tables. (DNS queries hi den). + +--- SECTION SEPARATOR --- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-2.snap index ab25252ad..7481b097f 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-2.snap @@ -1,55 +1,24 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 22Bps - - - 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps - - - - - - - - - - - - - - - - - - - - - - - - :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps - - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-3.snap deleted file mode 100644 index e3182172f..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab-3.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" ---- - - remote addr ss connection──── - Remote Address Connections Up / Down Connection Proc ss - .1.1.1 1 0Bps / 22Bps to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 22Bps + + + 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps + + + + + + + + + + + + + + + + + + + + + + + + :443 => 1.1.1.1:12345 (tcp) 1 0Bps / 22Bps + + + + + + + + + + + + + + + + + + + + + + + +--- SECTION SEPARATOR --- + + remote addr ss connection──── + Remote Address Connections Up / Down Connection Proc ss + .1.1.1 1 0Bps / 22Bps to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- 41Bps @@ -51,5 +103,57 @@ expression: "&terminal_draw_events_mirror[1]" + + +--- SECTION SEPARATOR --- + 65 + + + 35 35 + 30 30 + + + + + + + + + + + + + + + + + + + + + + + 35 + 30 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-2.snap index 5704676d4..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" +expression: terminal_events.lock().unwrap().as_slice() --- - 53 60 - - - 31 2 31 2 - 22 27 22 27 - - - - - - - - - - - - - - - - - - - - - - - 31 2 - 22 27 - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional.snap index 21308720f..05198bf10 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional.snap @@ -1,7 +1,59 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- + Total Up / Down: 0Bps / 0Bps +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- 45Bps / 49Bps @@ -51,5 +103,57 @@ expression: "&terminal_draw_events_mirror[1]" + + +--- SECTION SEPARATOR --- + 53 60 + + + 31 2 31 2 + 22 27 22 27 + + + + + + + + + + + + + + + + + + + + + + + 31 2 + 22 27 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-2.snap index b088284fb..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2].replace(\"1 \\n\", \"2 \\n\")" +expression: terminal_events.lock().unwrap().as_slice() --- - 98 109B 2 - - - 59 62 59 62 - 39 45 39 45 - - - - - - - - - - - - - - - - - - - - - - - 59 62 - 39 45 - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total.snap index dd20f696a..671910427 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total.snap @@ -1,8 +1,60 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - 45B / 49B 1 + Total Up / Down: 0B / 0B +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 45B / 49B 1 1 28B / 30B 1.1.1.1 1 28B / 30B @@ -51,5 +103,57 @@ expression: "&terminal_draw_events_mirror[1]" + + +--- SECTION SEPARATOR --- + 98 109B + + + 59 62 59 62 + 39 45 39 45 + + + + + + + + + + + + + + + + + + + + + + + 59 62 + 39 45 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-2.snap index 4853186d6..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2].replace(\"1 \\n\", \"2 \\n\")" +expression: terminal_events.lock().unwrap().as_slice() --- - 106B 2 - - - 57 57 - 4 4 - - - - - - - - - - - - - - - - - - - - - - - 57 - 4 - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total.snap index 906c3a338..2be57a74e 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total.snap @@ -1,8 +1,60 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - 41B 1 + Total Up / Down: 0B / 0B +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 41B 1 1 0B / 22B 1.1.1.1 1 0B / 22B @@ -51,5 +103,57 @@ expression: "&terminal_draw_events_mirror[1]" + + +--- SECTION SEPARATOR --- + 106B + + + 57 57 + 4 4 + + + + + + + + + + + + + + + + + + + + + + + 57 + 4 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-2.snap index 8d9b2dfa4..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" +expression: terminal_events.lock().unwrap().as_slice() --- - 31 - - - 31 31 - - - - - - - - - - - - - - - - - - - - - - - - 31 - - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process.snap index ab25252ad..c305d5347 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process.snap @@ -1,7 +1,59 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- + Total Up / Down: 0Bps / 0Bps +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- 22Bps @@ -50,6 +102,58 @@ expression: "&terminal_draw_events_mirror[1]" + + + +--- SECTION SEPARATOR --- + 31 + + + 31 31 + + + + + + + + + + + + + + + + + + + + + + + + 31 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-2.snap index cbc0e1f58..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2].replace(\"1 \\n\", \"2 \\n\")" +expression: terminal_events.lock().unwrap().as_slice() --- - 53 2 - - - 53 53 - - - - - - - - - - - - - - - - - - - - - - - - 53 - - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total.snap index 8fa74253d..8cde6c1b5 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total.snap @@ -1,8 +1,60 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - 22B 1 + Total Up / Down: 0B / 0B +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 22B 1 1 0B / 22B 1.1.1.1 1 0B / 22B @@ -50,6 +102,58 @@ expression: "&terminal_draw_events_mirror[1]" + + + +--- SECTION SEPARATOR --- + 53 + + + 53 53 + + + + + + + + + + + + + + + + + + + + + + + + 53 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-2.snap index a55cf71a9..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" +expression: terminal_events.lock().unwrap().as_slice() --- - 53 60 - - - 31 2 one one.one.one 31 2 - 22 27 three three.three.three 22 27 - - - - - - - - - - - - - - - - - - - - - - - one one.one.one:12345 (tcp) 31 2 - three three.three.three:1337 (tcp) 22 27 - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names.snap index 21308720f..cc0fc510d 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names.snap @@ -1,7 +1,59 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- + Total Up / Down: 0Bps / 0Bps +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- 45Bps / 49Bps @@ -51,5 +103,57 @@ expression: "&terminal_draw_events_mirror[1]" + + +--- SECTION SEPARATOR --- + 53 60 + + + 31 2 one one.one.one 31 2 + 22 27 three three.three.three 22 27 + + + + + + + + + + + + + + + + + + + + + + + one one.one.one:12345 (tcp) 31 2 + three three.three.three:1337 (tcp) 22 27 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-2.snap index 8552ae7d7..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_events.lock().unwrap().as_slice() --- - 21Bps / 0Bps - - - 1 1 21Bps / 0Bps 1.1.1.1 1 21Bps / 0Bps - - - - - - - - - - - - - - - - - - - - - - - - :443 => 1.1.1.1:12345 (tcp) 1 21Bps / 0Bps - - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-3.snap deleted file mode 100644 index d710afbc2..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-3.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-4.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-4.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event-4.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event.snap index d60e59734..f932e9be5 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,108 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 21Bps / 0Bps + + + 1 1 21Bps / 0Bps 1.1.1.1 1 21Bps / 0Bps + + + + + + + + + + + + + + + + + + + + + + + + :443 => 1.1.1.1:12345 (tcp) 1 21Bps / 0Bps + + + + + + + + + + + + + + + + + + + + + + + +--- SECTION SEPARATOR --- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-2.snap index a257bc440..ea1dad190 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-2.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-2.snap @@ -1,55 +1,18 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[2]" +expression: terminal_events.lock().unwrap().as_slice() --- - 53 60 - - - 31 2 i am.not.too.long 31 2 - 22 27 i am.an.obno[...]really.i.ask 22 27 - - - - - - - - - - - - - - - - - - - - - - - i am.not.too.long:12345 (tcp) 31 2 - i am.an.obnoxiosuly.lo[...]hy.would.anyone.do.this.really.i.ask:1337 (tcp) 22 27 - - - - - - - - - - - - - - - - - - - - - - +[ + Clear, + HideCursor, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + Draw, + HideCursor, + Flush, + ShowCursor, +] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-3.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-3.snap deleted file mode 100644 index ea1dad190..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames-3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: terminal_events.lock().unwrap().as_slice() ---- -[ - Clear, - HideCursor, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - Draw, - HideCursor, - Flush, - ShowCursor, -] diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames.snap index 21308720f..4358d8e1e 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames.snap @@ -1,7 +1,59 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- + Total Up / Down: 0Bps / 0Bps +┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ +│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│Connection Process Up / Down │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- 45Bps / 49Bps @@ -51,5 +103,57 @@ expression: "&terminal_draw_events_mirror[1]" + + +--- SECTION SEPARATOR --- + 53 60 + + + 31 2 i am.not.too.long 31 2 + 22 27 i am.an.obno[...]really.i.ask 22 27 + + + + + + + + + + + + + + + + + + + + + + + i am.not.too.long:12345 (tcp) 31 2 + i am.an.obnoxiosuly.lo[...]hy.would.anyone.do.this.really.i.ask:1337 (tcp) 22 27 + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses-2.snap deleted file mode 100644 index 18ef7bdce..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses-2.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 24Bps / 25Bps - - - 1.1.1.1 1 24Bps / 25Bps - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses.snap index b6057c35a..cd8d045df 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by remote address───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 24Bps / 25Bps + + + 1.1.1.1 1 24Bps / 25Bps + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections-2.snap deleted file mode 100644 index 4904c73e4..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections-2.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 24Bps / 25Bps - - - :443 => 1.1.1.1:12345 (tcp) 1 24Bps / 25Bps - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections.snap index d58004157..742056381 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 24Bps / 25Bps + + + :443 => 1.1.1.1:12345 (tcp) 1 24Bps / 25Bps + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes-2.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes-2.snap deleted file mode 100644 index 438c8069a..000000000 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes-2.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[1]" ---- - 24Bps / 25Bps - - - 1 1 24Bps / 25Bps - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes.snap index 60bee0fdf..c5e33ec24 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by process name─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). + +--- SECTION SEPARATOR --- + 24Bps / 25Bps + + + 1 1 24Bps / 25Bps + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_horizontally.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_horizontally.snap index d59324a50..5c8b25201 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_horizontally.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_horizontally.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by remote address─────────────────────────────┐ @@ -52,4 +52,56 @@ expression: "&terminal_draw_events_mirror[0]" │ │ └──────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. + +--- SECTION SEPARATOR --- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_vertically.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_vertically.snap index f76324d40..cba7a47aa 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_vertically.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_vertically.snap @@ -1,6 +1,6 @@ --- source: src/tests/cases/ui.rs -expression: "&terminal_draw_events_mirror[0]" +expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- Total Up / Down: 0Bps / 0Bps ┌Utilization by remote address────────────────────────────────────────────────────────────────┐┌Utilization by connection────────────────────────────────────────────────────────────────────┐ diff --git a/src/tests/cases/test_utils.rs b/src/tests/cases/test_utils.rs index 4c1d4227f..bed4642ea 100644 --- a/src/tests/cases/test_utils.rs +++ b/src/tests/cases/test_utils.rs @@ -21,21 +21,27 @@ use crate::{ }; pub fn sleep_and_quit_events(sleep_num: usize) -> Box { - let mut events: Vec> = iter::repeat(None).take(sleep_num).collect(); - events.push(Some(Event::Key(KeyEvent::new( - KeyCode::Char('c'), - KeyModifiers::CONTROL, - )))); + let events = iter::repeat(None) + .take(sleep_num) + .chain([Some(Event::Key(KeyEvent::new( + KeyCode::Char('c'), + KeyModifiers::CONTROL, + )))]) + .collect(); Box::new(TerminalEvents::new(events)) } pub fn sleep_resize_and_quit_events(sleep_num: usize) -> Box { - let mut events: Vec> = iter::repeat(None).take(sleep_num).collect(); - events.push(Some(Event::Resize(100, 100))); - events.push(Some(Event::Key(KeyEvent::new( - KeyCode::Char('c'), - KeyModifiers::CONTROL, - )))); + let events = iter::repeat(None) + .take(sleep_num) + .chain([ + Some(Event::Resize(100, 100)), + Some(Event::Key(KeyEvent::new( + KeyCode::Char('c'), + KeyModifiers::CONTROL, + ))), + ]) + .collect(); Box::new(TerminalEvents::new(events)) } diff --git a/src/tests/cases/ui.rs b/src/tests/cases/ui.rs index 01fe8d17f..220928461 100644 --- a/src/tests/cases/ui.rs +++ b/src/tests/cases/ui.rs @@ -1,7 +1,8 @@ -use std::{collections::HashMap, iter, net::IpAddr}; +use std::{collections::HashMap, net::IpAddr}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use insta::{assert_debug_snapshot, assert_snapshot}; +use itertools::Itertools; use pnet::datalink::DataLinkReceiver; use rstest::rstest; @@ -22,6 +23,8 @@ use crate::{ Opt, OsInputOutput, }; +const SNAPSHOT_SECTION_SEPARATOR: &str = "\n--- SECTION SEPARATOR ---\n"; + #[test] fn basic_startup() { let network_frames = vec![NetworkFrames::new(vec![ @@ -32,11 +35,11 @@ fn basic_startup() { let os_input = os_input_output(network_frames, 1); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 1); - assert_snapshot!(&terminal_draw_events_mirror[0]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -62,35 +65,28 @@ fn pause_by_space() { )), ]) as Box]; - // sleep for 1s, then press space, sleep for 2s, then quit - let mut events: Vec> = iter::repeat(None).take(1).collect(); - events.push(Some(Event::Key(KeyEvent::new( - KeyCode::Char(' '), - KeyModifiers::NONE, - )))); - events.push(None); - events.push(None); - events.push(Some(Event::Key(KeyEvent::new( - KeyCode::Char(' '), - KeyModifiers::NONE, - )))); - events.push(Some(Event::Key(KeyEvent::new( - KeyCode::Char('c'), - KeyModifiers::CONTROL, - )))); + let events = [ + None, + Some(KeyEvent::new(KeyCode::Char(' '), KeyModifiers::NONE)), + None, + None, + Some(KeyEvent::new(KeyCode::Char(' '), KeyModifiers::NONE)), + Some(KeyEvent::new(KeyCode::Char('c'), KeyModifiers::CONTROL)), + ] + .into_iter() + .map(|ke| ke.map(Event::Key)) + .collect_vec(); let events = Box::new(TerminalEvents::new(events)); let os_input = os_input_output_factory(network_frames, None, None, events); let (terminal_events, terminal_draw_events, backend) = test_backend_factory(190, 50); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 3); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); - assert_snapshot!(&terminal_draw_events_mirror[2]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -116,34 +112,28 @@ fn rearranged_by_tab() { )), ]) as Box]; - // sleep for 1s, then press tab, sleep for 2s, then quit - let mut events: Vec> = iter::repeat(None).take(1).collect(); - events.push(None); - events.push(Some(Event::Key(KeyEvent::new( - KeyCode::Tab, - KeyModifiers::NONE, - )))); - events.push(None); - events.push(None); - events.push(Some(Event::Key(KeyEvent::new( - KeyCode::Char('c'), - KeyModifiers::CONTROL, - )))); + let events = [ + None, + None, + Some(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE)), + None, + None, + Some(KeyEvent::new(KeyCode::Char('c'), KeyModifiers::CONTROL)), + ] + .into_iter() + .map(|ke| ke.map(Event::Key)) + .collect_vec(); let events = Box::new(TerminalEvents::new(events)); let os_input = os_input_output_factory(network_frames, None, None, events); let (terminal_events, terminal_draw_events, backend) = test_backend_factory(190, 50); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 5); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); - assert_snapshot!(&terminal_draw_events_mirror[2]); - assert_snapshot!(&terminal_draw_events_mirror[3]); - assert_snapshot!(&terminal_draw_events_mirror[4]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -162,10 +152,12 @@ fn basic_only_processes() { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[test] @@ -184,10 +176,12 @@ fn basic_processes_with_dns_queries() { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[test] @@ -205,10 +199,12 @@ fn basic_only_connections() { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[test] @@ -226,10 +222,12 @@ fn basic_only_addresses() { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[rstest(sample_frames_short as frames)] @@ -243,11 +241,12 @@ fn two_packets_only_processes(frames: Vec>) { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[rstest(sample_frames_short as frames)] @@ -261,11 +260,12 @@ fn two_packets_only_connections(frames: Vec>) { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[rstest(sample_frames_short as frames)] @@ -279,11 +279,12 @@ fn two_packets_only_addresses(frames: Vec>) { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[test] @@ -302,10 +303,12 @@ fn two_windows_split_horizontally() { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[test] @@ -324,10 +327,12 @@ fn two_windows_split_vertically() { }, ..opts_ui() }; - start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - assert_snapshot!(&terminal_draw_events_mirror[0]); + + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); } #[test] @@ -343,12 +348,11 @@ fn one_packet_of_traffic() { let os_input = os_input_output(network_frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -358,12 +362,11 @@ fn bi_directional_traffic(frames: Vec>) { let os_input = os_input_output(frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -390,12 +393,11 @@ fn multiple_packets_of_traffic_from_different_connections() { let os_input = os_input_output(network_frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -422,12 +424,11 @@ fn multiple_packets_of_traffic_from_single_connection() { let os_input = os_input_output(network_frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -454,12 +455,11 @@ fn one_process_with_multiple_connections() { let os_input = os_input_output(network_frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -500,12 +500,11 @@ fn multiple_processes_with_multiple_connections() { let os_input = os_input_output(network_frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -532,12 +531,11 @@ fn multiple_connections_from_remote_address() { let os_input = os_input_output(network_frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -548,12 +546,11 @@ fn sustained_traffic_from_one_process(frames: Vec>) { let os_input = os_input_output(frames, 3); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 3); - assert_snapshot!(&terminal_draw_events_mirror[1]); - assert_snapshot!(&terminal_draw_events_mirror[2]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -565,12 +562,11 @@ fn sustained_traffic_from_one_process_total(frames: Vec>) { }; let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 3); - assert_snapshot!(&terminal_draw_events_mirror[1]); - assert_snapshot!(&terminal_draw_events_mirror[2]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -713,12 +704,11 @@ fn truncate_long_hostnames(network_frames: Vec>) { }; let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 3); - assert_snapshot!(&terminal_draw_events_mirror[1]); - assert_snapshot!(&terminal_draw_events_mirror[2]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -752,12 +742,11 @@ fn no_resolve_mode(network_frames: Vec>) { }; let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 3); - assert_snapshot!(&terminal_draw_events_mirror[1]); - assert_snapshot!(&terminal_draw_events_mirror[2]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -786,13 +775,11 @@ fn traffic_with_winch_event() { }; let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); - - assert_eq!(terminal_draw_events_mirror.len(), 3); - assert_snapshot!(&terminal_draw_events_mirror[0]); - assert_snapshot!(&terminal_draw_events_mirror[1]); - assert_snapshot!(&terminal_draw_events_mirror[2]); + assert_snapshot!(terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR)); assert_debug_snapshot!(terminal_events.lock().unwrap().as_slice()); } @@ -839,20 +826,16 @@ fn layout(#[case] name: &str, #[case] width: u16, #[case] height: u16) { let os_input = os_input_output(network_frames, 2); let opts = opts_ui(); start(backend, os_input, opts); - let terminal_draw_events_mirror = terminal_draw_events.lock().unwrap(); + assert_snapshot!( + format!("layout-{name}-draw_events"), + terminal_draw_events + .lock() + .unwrap() + .join(SNAPSHOT_SECTION_SEPARATOR) + ); assert_debug_snapshot!( format!("layout-{name}-events"), terminal_events.lock().unwrap().as_slice() ); - - assert_eq!(terminal_draw_events_mirror.len(), 2); - assert_snapshot!( - format!("layout-{name}-draw_events-0"), - &terminal_draw_events_mirror[0] - ); - assert_snapshot!( - format!("layout-{name}-draw_events-1"), - &terminal_draw_events_mirror[1] - ); }