Merge pull request 'Fix the antispam test: pin the rules it scores against, stop live Pyzor' (#24) from fix/antispam-test into main
ci / fork-checks (push) Successful in 2m4s
ci / build (push) Successful in 6m26s

Reviewed-on: #24
This commit was merged in pull request #24.
This commit is contained in:
2026-09-23 04:12:40 +00:00
4 changed files with 50 additions and 29 deletions
+15 -2
View File
@@ -68,6 +68,10 @@ use std::{
time::{Duration, Instant},
};
// inbuxa: its HTTP listener (19048) is shared with the dkim2 and report
// tests, which are serial; without this it ran beside them and each got the
// other's server.
#[serial_test::serial]
#[tokio::test(flavor = "multi_thread")]
async fn antispam() {
let mut test = TestServerBuilder::new("smtp_antispam_test")
@@ -81,9 +85,18 @@ async fn antispam() {
admin
.registry_create_object(SpamSettings {
score_spam: Float::new(5.0),
// inbuxa: the rules carry the scores the expectations are written
// against, so they're pinned (spam-filter v3.0.2, beside the test
// cases) rather than read from a developer's own checkout, which
// left every score at zero. SPAM_RULES_URL still overrides.
spam_filter_rules_url: std::env::var("SPAM_RULES_URL")
.unwrap_or_else(|_| {
"file:///Users/me/code/spam-filter/spam-filter-rules.json.gz".to_string()
concat!(
"file://",
env!("CARGO_MANIFEST_DIR"),
"/resources/smtp/antispam/spam-filter-rules.json.gz"
)
.to_string()
})
.into(),
..Default::default()
@@ -156,7 +169,7 @@ async fn antispam() {
}))
.await;
// inbuxa: a rules file that can't be read is retried later; don't wait
// for that retry (the path above is a developer's own checkout)
// for that retry (SPAM_RULES_URL may name one that isn't there)
test.wait_for_tasks_skip_not_due().await;
admin.reload_settings().await;
admin.reload_lookup_stores().await;