From 44c3dfe0f46942b4ef9feae799ac4339c667445f Mon Sep 17 00:00:00 2001 From: Stephan Boyer Date: Tue, 1 Sep 2026 17:34:41 -0700 Subject: [PATCH] Test container status invariant --- src/run.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/run.rs b/src/run.rs index a479653..ab47bd4 100644 --- a/src/run.rs +++ b/src/run.rs @@ -37,9 +37,9 @@ const CONTAINER_STATUSES: [&str; 7] = [ "dead", "exited", "paused", + "removing", "restarting", "running", - "removing", ]; // A Docker event (a line of output from `docker system events --format '{{json .}}'`) @@ -946,7 +946,10 @@ pub fn run( #[cfg(test)] mod tests { - use super::{ImageNode, ImageRecord, RepositoryTag, construct_polyforest, parse_docker_date}; + use super::{ + CONTAINER_STATUSES, ImageNode, ImageRecord, RepositoryTag, + UNINSPECTABLE_CONTAINER_STATUSES, construct_polyforest, parse_docker_date, + }; use crate::state::{self, State}; use std::{ collections::{HashMap, HashSet}, @@ -954,6 +957,15 @@ mod tests { time::Duration, }; + #[test] + fn uninspectable_container_statuses_are_container_statuses() { + assert!( + UNINSPECTABLE_CONTAINER_STATUSES + .iter() + .all(|status| CONTAINER_STATUSES.contains(status)), + ); + } + #[test] fn parse_docker_date_valid() { assert_eq!(