File tree Expand file tree Collapse file tree 5 files changed +18
-6
lines changed
Expand file tree Collapse file tree 5 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ use torrust_tracker_deploy::e2e::tasks::run_configure_command::run_configure_com
5151use tracing:: { error, info} ;
5252
5353use torrust_tracker_deploy:: config:: InstanceName ;
54+ use torrust_tracker_deploy:: domain:: Username ;
5455use torrust_tracker_deploy:: e2e:: environment:: { TestEnvironment , TestEnvironmentType } ;
5556use torrust_tracker_deploy:: e2e:: tasks:: {
5657 container:: {
@@ -114,10 +115,12 @@ pub async fn main() -> Result<()> {
114115 let instance_name =
115116 InstanceName :: new ( "torrust-tracker-vm" . to_string ( ) ) . expect ( "Valid hardcoded instance name" ) ;
116117
118+ let ssh_user = Username :: new ( "torrust" ) . expect ( "Valid hardcoded username" ) ;
119+
117120 let env = TestEnvironment :: initialized (
118121 false ,
119122 cli. templates_dir ,
120- "torrust" ,
123+ & ssh_user ,
121124 instance_name,
122125 TestEnvironmentType :: Container ,
123126 ) ?;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ use tracing::{error, info};
2323
2424// Import E2E testing infrastructure
2525use torrust_tracker_deploy:: config:: InstanceName ;
26+ use torrust_tracker_deploy:: domain:: Username ;
2627use torrust_tracker_deploy:: e2e:: environment:: { TestEnvironment , TestEnvironmentType } ;
2728use torrust_tracker_deploy:: e2e:: tasks:: {
2829 preflight_cleanup:: cleanup_lingering_resources,
@@ -98,10 +99,12 @@ pub async fn main() -> Result<()> {
9899 let instance_name =
99100 InstanceName :: new ( "torrust-tracker-vm" . to_string ( ) ) . expect ( "Valid hardcoded instance name" ) ;
100101
102+ let ssh_user = Username :: new ( "torrust" ) . expect ( "Valid hardcoded username" ) ;
103+
101104 let env = TestEnvironment :: initialized (
102105 cli. keep ,
103106 cli. templates_dir ,
104- "torrust" ,
107+ & ssh_user ,
105108 instance_name,
106109 TestEnvironmentType :: VirtualMachine ,
107110 ) ?;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ use tracing::{error, info};
2828
2929// Import E2E testing infrastructure
3030use torrust_tracker_deploy:: config:: InstanceName ;
31+ use torrust_tracker_deploy:: domain:: Username ;
3132use torrust_tracker_deploy:: e2e:: environment:: { TestEnvironment , TestEnvironmentType } ;
3233use torrust_tracker_deploy:: e2e:: tasks:: {
3334 preflight_cleanup:: cleanup_lingering_resources,
@@ -97,10 +98,12 @@ pub async fn main() -> Result<()> {
9798 let instance_name =
9899 InstanceName :: new ( "torrust-tracker-vm" . to_string ( ) ) . expect ( "Valid hardcoded instance name" ) ;
99100
101+ let ssh_user = Username :: new ( "torrust" ) . expect ( "Valid hardcoded username" ) ;
102+
100103 let env = TestEnvironment :: initialized (
101104 cli. keep ,
102105 cli. templates_dir ,
103- "torrust" ,
106+ & ssh_user ,
104107 instance_name,
105108 TestEnvironmentType :: VirtualMachine ,
106109 ) ?;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ use tracing::{info, warn};
2626
2727use crate :: config:: { Config , InstanceName , SshCredentials } ;
2828use crate :: container:: Services ;
29+ use crate :: domain:: Username ;
2930
3031/// Errors that can occur during test environment creation and initialization
3132#[ derive( Debug , thiserror:: Error ) ]
@@ -109,7 +110,7 @@ impl TestEnvironment {
109110 pub fn initialized (
110111 keep_env : bool ,
111112 templates_dir : impl Into < std:: path:: PathBuf > ,
112- ssh_user : & str ,
113+ ssh_user : & Username ,
113114 instance_name : InstanceName ,
114115 environment_type : TestEnvironmentType ,
115116 ) -> Result < Self , TestEnvironmentError > {
@@ -189,7 +190,7 @@ impl TestEnvironment {
189190 fn setup_ssh_credentials (
190191 project_root : & std:: path:: Path ,
191192 temp_dir : & TempDir ,
192- ssh_user : & str ,
193+ ssh_user : & Username ,
193194 ) -> Result < SshCredentials , TestEnvironmentError > {
194195 let temp_ssh_key = temp_dir. path ( ) . join ( SSH_PRIVATE_KEY_FILENAME ) ;
195196 let temp_ssh_pub_key = temp_dir. path ( ) . join ( SSH_PUBLIC_KEY_FILENAME ) ;
Original file line number Diff line number Diff line change @@ -64,14 +64,16 @@ use crate::infrastructure::ansible::AnsibleTemplateRenderer;
6464/// use torrust_tracker_deploy::e2e::tasks::container::run_provision_simulation::run_provision_simulation;
6565/// use torrust_tracker_deploy::e2e::environment::{TestEnvironment, TestEnvironmentType};
6666/// use torrust_tracker_deploy::config::InstanceName;
67+ /// use torrust_tracker_deploy::domain::Username;
6768///
6869/// #[tokio::main]
6970/// async fn main() -> anyhow::Result<()> {
7071/// let instance_name = InstanceName::new("test-container".to_string())?;
72+ /// let ssh_user = Username::new("torrust")?;
7173/// let test_env = TestEnvironment::initialized(
7274/// false,
7375/// "./templates".to_string(),
74- /// "torrust" ,
76+ /// &ssh_user ,
7577/// instance_name,
7678/// TestEnvironmentType::Container
7779/// )?;
You can’t perform that action at this time.
0 commit comments