-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmod.rs
More file actions
49 lines (47 loc) · 1.74 KB
/
Copy pathmod.rs
File metadata and controls
49 lines (47 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Container Actions
//!
//! This module provides actions that can be performed on running containers.
//! Actions are decoupled from container implementations, making them reusable
//! and testable independently.
//!
//! ## Architecture
//!
//! Container actions follow a trait-based architecture:
//! - Actions that need to execute commands inside containers use `ContainerExecutor`
//! - Actions that interact with containers externally (like network connectivity checks) don't need the trait
//! - Each action is responsible for a single, well-defined operation
//!
//! ## Available Actions
//!
//! - **SSH Key Setup** - Configure SSH key authentication inside a container
//! - **SSH Wait** - Wait for SSH connectivity to become available
//!
//! ## Usage Examples
//!
//! ```rust,no_run
//! use torrust_tracker_deployer_lib::testing::e2e::containers::{ContainerExecutor, actions::{SshKeySetupAction, SshWaitAction}};
//! use torrust_tracker_deployer_lib::adapters::ssh::SshCredentials;
//! use std::time::Duration;
//! use std::net::SocketAddr;
//!
//! async fn setup_container_ssh<T: ContainerExecutor>(
//! container: &T,
//! ssh_credentials: &SshCredentials,
//! socket_addr: SocketAddr,
//! ) -> Result<(), Box<dyn std::error::Error>> {
//! // Setup SSH keys inside the container
//! let ssh_setup = SshKeySetupAction::new();
//! ssh_setup.execute(container, ssh_credentials).await?;
//!
//! // Wait for SSH to be accessible
//! let ssh_wait = SshWaitAction::new(Duration::from_secs(30), 10);
//! ssh_wait.execute(socket_addr)?;
//!
//! Ok(())
//! }
//! ```
pub mod ssh_key_setup;
pub mod ssh_wait;
// Re-export action types for easy access
pub use ssh_key_setup::SshKeySetupAction;
pub use ssh_wait::SshWaitAction;