Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/infrastructure/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,14 @@ mod tests {
.expect("follow-up request should coalesce");
assert!(worker.has_pending());

let deadline = Instant::now() + Duration::from_secs(2);
// The collector publishes `CollectorPanicked` only after the panic hook
// flushes diagnostics and the default hook captures a backtrace. CI sets
// `RUST_BACKTRACE=1`, so a loaded Windows runner needs this longer poll
// before that report and the reinitialized follow-up can be observed.
const DRAIN_BUDGET: Duration = Duration::from_secs(30);
const POLL_INTERVAL: Duration = Duration::from_millis(20);

let deadline = Instant::now() + DRAIN_BUDGET;
loop {
let drained = worker.drain(null_mut());
if drained.error == Some(ERROR_GEN_FAILURE) {
Expand All @@ -922,10 +929,10 @@ mod tests {
break;
}
assert!(Instant::now() < deadline, "panic report timed out");
thread::yield_now();
thread::sleep(POLL_INTERVAL);
}

let deadline = Instant::now() + Duration::from_secs(2);
let deadline = Instant::now() + DRAIN_BUDGET;
loop {
let drained = worker.drain(null_mut());
assert_eq!(drained.error, None);
Expand All @@ -939,7 +946,7 @@ mod tests {
Instant::now() < deadline,
"reinitialized collector timed out"
);
thread::yield_now();
thread::sleep(POLL_INTERVAL);
}
}

Expand Down
21 changes: 20 additions & 1 deletion src/pages/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,9 @@ impl NetworkPageState {
(titles[2], 90, LVCFMT_RIGHT),
(titles[3], 120, LVCFMT_LEFT),
(titles[4], 140, LVCFMT_LEFT),
(titles[5], 110, LVCFMT_RIGHT),
(titles[6], 120, LVCFMT_RIGHT),
(titles[7], 110, LVCFMT_RIGHT),
];

for (index, (title, width, fmt)) in columns.iter().enumerate() {
Expand Down Expand Up @@ -1406,13 +1409,16 @@ fn push_history(history: &mut HistoryBuffer, value: Option<u8>) {
}
}

fn adapter_row_texts(adapter: &NetworkAdapterEntry) -> [&str; 5] {
fn adapter_row_texts(adapter: &NetworkAdapterEntry) -> [&str; 8] {
[
&adapter.name,
&adapter.utilization,
&adapter.link_speed,
&adapter.state,
&adapter.ipv4,
&adapter.bytes_sent,
&adapter.bytes_received,
&adapter.bytes_total,
]
}

Expand Down Expand Up @@ -2064,7 +2070,20 @@ mod tests {
let adapter = test_adapter("Renamed Ethernet");
let columns = adapter_row_texts(&adapter);
assert_eq!(columns[0], "Renamed Ethernet");
assert_eq!(columns[2], "1.0 Gbps");
assert_eq!(columns[4], "192.168.0.2");
assert_eq!(columns[5], "10");
assert_eq!(columns[6], "20");
assert_eq!(columns[7], "30");

let mut failed = adapter;
failed.bytes_sent = "-".to_string();
failed.bytes_received = "-".to_string();
failed.bytes_total = "-".to_string();
let failed_columns = adapter_row_texts(&failed);
assert_eq!(failed_columns[5], "-");
assert_eq!(failed_columns[6], "-");
assert_eq!(failed_columns[7], "-");
}

#[test]
Expand Down