fix(test-cluster): manage containers via testcontainers' Docker client so start/stop share one runtime#624
Open
beryllw wants to merge 1 commit into
Open
fix(test-cluster): manage containers via testcontainers' Docker client so start/stop share one runtime#624beryllw wants to merge 1 commit into
beryllw wants to merge 1 commit into
Conversation
…t so start/stop share one runtime
leekeiabstraction
left a comment
Contributor
There was a problem hiding this comment.
Thank you for the improvements. Left some small comments.
Comment on lines
+225
to
+238
| for name in self.container_names() { | ||
| // Anchored exact-name match; `all(false)` = running only, so a stopped | ||
| // leftover counts as absent and gets recreated. | ||
| let mut filters = HashMap::new(); | ||
| filters.insert("name".to_string(), vec![format!("^{name}$")]); | ||
| let options = ListContainersOptionsBuilder::default() | ||
| .all(false) | ||
| .filters(&filters) | ||
| .build(); | ||
| match docker.list_containers(Some(options)).await { | ||
| Ok(list) if !list.is_empty() => continue, | ||
| _ => return false, | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
nit: Seems like we're making a list_containers per-container. Anyway to make this more efficient?
Comment on lines
+576
to
+596
| let mut filters = HashMap::new(); | ||
| filters.insert( | ||
| "name".to_string(), | ||
| vec![ | ||
| format!("zookeeper-{name}"), | ||
| format!("coordinator-server-{name}"), | ||
| format!("tablet-server-{name}-"), | ||
| ], | ||
| ); | ||
| let options = ListContainersOptionsBuilder::default() | ||
| .all(true) | ||
| .filters(&filters) | ||
| .build(); | ||
|
|
||
| let containers = match docker.list_containers(Some(options)).await { | ||
| Ok(containers) => containers, | ||
| Err(e) => { | ||
| eprintln!("warning: failed to list cluster containers: {e}"); | ||
| return; | ||
| } | ||
| }; |
Contributor
There was a problem hiding this comment.
nit: This looks similar to parts of all_containers_exist, can these be refactored?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #623
Brief change log
Tests
Verified against a live Podman cluster:
cargo build / cargo clippy clean for the crate (the 3 pre-existing main.rs readiness-poll lints are untouched and out of scope).
API and Format
Documentation