Create a container name from a node name and a logical container name, e.g. "cometbft" in a way that we can use it as a hostname without being too long. It consists of `{node-id}-{container}-{hash(node-name)}`, e.g. "node-12-cometbft-a1b2c3"
(node_name: &NodeName, container: &str)
| 621 | /// It consists of `{node-id}-{container}-{hash(node-name)}`, |
| 622 | /// e.g. "node-12-cometbft-a1b2c3" |
| 623 | pub fn container_name(node_name: &NodeName, container: &str) -> String { |
| 624 | let node_id = node_name |
| 625 | .path() |
| 626 | .file_stem() |
| 627 | .unwrap_or_default() |
| 628 | .to_string_lossy() |
| 629 | .to_string(); |
| 630 | let hash = ResourceHash::digest(node_name.path_string()); |
| 631 | let hash = hash.to_string(); |
| 632 | let hash = &hash.as_str()[..6]; |
| 633 | format!("{node_id}-{container}-{}", hash) |
| 634 | } |
| 635 | |
| 636 | /// Collect comma separated values from seeds nodes. |
| 637 | fn collect_seeds<F>(seed_nodes: &[&DockerNode], f: F) -> anyhow::Result<String> |
no test coverage detected