Skip to content

Commit

Permalink
Merge branch 'main' into gh_main
Browse files Browse the repository at this point in the history
  • Loading branch information
dyegomb committed Nov 19, 2024
2 parents 0259ad4 + 4c69f4f commit 4bbee3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 7 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ mod integration_tests {
// "variables": {"trigger_email":"teste@test.tst"},
// "variables": {"ref_source":"master"},
// "variables": {"source_id":config.project_id.unwrap_or(0).to_string()},
"variables": {"PROD_TAG": "PROD-test-1.0.0"},
"variables": {
"PROD_TAG": "Test-tag",
"trigger_email":"test@test.tst"
},
}
);

Expand Down Expand Up @@ -94,7 +97,9 @@ mod integration_tests {

let mail_relay_handle = tokio::spawn(utils::mailrelay_build(config.clone().unwrap()));

let test_job = JobInfo::default();
let mut test_job = JobInfo::default();

test_job.user_mail = Some("test@test.tst".to_string());

let message = utils::mail_message(
&test_job,
Expand Down
11 changes: 2 additions & 9 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub async fn mailrelay_build(smtp_config: SmtpConfig) -> Option<SmtpTransport> {
}
Err(error) => {
error!("{}", error);
return None;
None
}
},
false => None,
Expand All @@ -37,14 +37,7 @@ pub fn mail_message(job: &JobInfo, reason: MailReason, builder: &SmtpConfig) ->
MailReason::Status(status) => format!("Status of job {}: {}", job, status),
};

let binding = builder.to.clone();
let to = match &job.user_mail {
Some(to) => match &binding {
None => Some(to.to_string()),
Some(to_inc) => Some(format!("{to}; {to_inc}")),
},
None => binding,
};
let to = job.user_mail.clone();

debug!("Sending mail to {:?}", &to);

Expand Down

0 comments on commit 4bbee3e

Please sign in to comment.