Queue autoconfig post install

This commit is contained in:
mdecimus
2025-07-13 12:01:32 +02:00
parent 036cb2ecd4
commit aee7337169
21 changed files with 302 additions and 280 deletions

View File

@@ -147,11 +147,8 @@ async fn strategies() {
received_from_ip: "1.2.3.4".parse().unwrap(),
received_via_port: 7911,
return_path: "test@example.com".to_string(),
return_path_lcase: "test@example.com".to_string(),
return_path_domain: "example.com".to_string(),
recipients: vec![Recipient {
address: "recipient@foobar.com".to_string(),
address_lcase: "recipient@foobar.com".to_string(),
retry: Schedule::now(),
notify: Schedule::now(),
expires: QueueExpiry::Ttl(3600),

View File

@@ -68,7 +68,7 @@ async fn throttle_outbound() {
// Build test message
let mut test_message = new_message(0).message;
test_message.return_path_domain = "foobar.org".into();
test_message.return_path = "test@foobar.org".into();
test_message
.recipients
.push(build_rcpt("bill@test.org", 0, 0, 0));
@@ -110,7 +110,7 @@ async fn throttle_outbound() {
local.queue_receiver.read_event().await.assert_on_hold();*/
// Expect rate limit throttle for sender domain 'foobar.net'
test_message.return_path_domain = "foobar.net".into();
test_message.return_path = "test@foobar.net".into();
for t in &throttle.sender {
core.is_allowed(
t,
@@ -136,7 +136,7 @@ async fn throttle_outbound() {
assert!(due > 0, "Due: {}", due);
// Expect concurrency throttle for recipient domain 'example.org'
test_message.return_path_domain = "test.net".into();
test_message.return_path = "test@test.net".into();
test_message
.recipients
.push(build_rcpt("test@example.org", 0, 0, 0));
@@ -286,7 +286,7 @@ impl<'x> TestQueueEnvelope<'x> for QueueEnvelope<'x> {
mx,
remote_ip: IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
local_ip: IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
domain: rcpt.address_lcase.domain_part(),
domain: rcpt.address.domain_part(),
rcpt,
}
}

View File

@@ -64,11 +64,8 @@ async fn generate_dsn() {
.duration_since(SystemTime::UNIX_EPOCH)
.map_or(0, |d| d.as_secs()),
return_path: "sender@foobar.org".into(),
return_path_lcase: "".into(),
return_path_domain: "foobar.org".into(),
recipients: vec![Recipient {
address: "foobar@example.org".into(),
address_lcase: "foobar@example.org".into(),
status: Status::PermanentFailure(ErrorDetails {
entity: "mx.example.org".into(),
details: Error::UnexpectedResponse(UnexpectedResponse {
@@ -125,7 +122,6 @@ async fn generate_dsn() {
// Success DSN
message.message.recipients.push(Recipient {
address: "jane@example.org".into(),
address_lcase: "jane@example.org".into(),
status: Status::Completed(HostResponse {
hostname: "mx2.example.org".into(),
response: Response {
@@ -148,7 +144,6 @@ async fn generate_dsn() {
// Delay DSN
message.message.recipients.push(Recipient {
address: "john.doe@example.org".into(),
address_lcase: "john.doe@example.org".into(),
status: Status::TemporaryFailure(ErrorDetails {
entity: "mx.domain.org".into(),
details: Error::ConnectionError("Connection timeout".into()),

View File

@@ -171,8 +171,6 @@ pub fn new_message(queue_id: u64) -> MessageWrapper {
size: 0,
created: now(),
return_path: "sender@foobar.org".into(),
return_path_lcase: "".into(),
return_path_domain: "foobar.org".into(),
recipients: vec![],
flags: 0,
env_id: None,
@@ -222,14 +220,14 @@ impl TestMessage for Message {
fn rcpt(&self, name: &str) -> &Recipient {
self.recipients
.iter()
.find(|d| d.address_lcase == name)
.find(|d| d.address == name)
.unwrap_or_else(|| panic!("Expected rcpt {name} not found in {:?}", self.recipients))
}
fn rcpt_mut(&mut self, name: &str) -> &mut Recipient {
self.recipients
.iter_mut()
.find(|d| d.address_lcase == name)
.find(|d| d.address == name)
.unwrap()
}
}

View File

@@ -24,7 +24,6 @@ pub mod virtualq;
pub fn build_rcpt(address: &str, retry: u64, notify: u64, expires: u64) -> Recipient {
Recipient {
address: address.to_string(),
address_lcase: address.to_string(),
retry: Schedule::later(retry),
notify: Schedule::later(notify),
expires: QueueExpiry::Ttl(expires),