Import upstream v0.16.24, stripped
Upstream commit: af37a234981722493b74623a983581691d2b70b6 Enterprise-only files removed or emptied: 63 Enterprise-only snippets removed: 118 in 50 files Dangling module declarations removed: 5 Edits turning enterprise off: 25 Third-party code: 14 files, 0 not in THIRD-PARTY.md Renamed identifiers: 62 in 18 files Verification: clean The same Enterprise footprint as v0.16.23. The build check fails only on tests/src/directory/issuer.rs, unchanged since v0.16.23: it calls a helper from upstream's Enterprise-only OIDC test, and tests issuer-based directory routing, an Enterprise feature. main has never carried it.
This commit is contained in:
@@ -129,6 +129,21 @@ pub async fn test(test: &TestServer) {
|
||||
assert_eq!(samples.iter().filter(|x| !x.1.is_spam).count(), 11);
|
||||
assert_eq!(samples.iter().filter(|x| x.1.is_spam).count(), 11);
|
||||
|
||||
let last_id = samples.iter().map(|(id, _)| id.id()).max().unwrap();
|
||||
for _ in 0..2 {
|
||||
admin
|
||||
.registry_create_object(Task::SpamFilterMaintenance(TaskSpamFilterMaintenance {
|
||||
maintenance_type: TaskSpamFilterMaintenanceType::Train,
|
||||
status: TaskStatus::now(),
|
||||
}))
|
||||
.await;
|
||||
test.wait_for_tasks().await;
|
||||
let model = spam_classifier_model(&test.server).await;
|
||||
assert_eq!(model.reservoir.ham.total_seen, 11);
|
||||
assert_eq!(model.reservoir.spam.total_seen, 11);
|
||||
assert_eq!(model.last_id, last_id);
|
||||
}
|
||||
|
||||
// Global spam samples should not appear in the account
|
||||
let samples = account.spam_training_samples().await;
|
||||
assert_eq!(samples.iter().filter(|x| !x.1.is_spam).count(), 11);
|
||||
|
||||
@@ -174,4 +174,53 @@ pub async fn test(imap: &mut ImapConnection, imap_check: &mut ImapConnection) {
|
||||
imap.assert_read(Type::Tagged, ResponseType::Ok)
|
||||
.await
|
||||
.assert_contains("COPYUID");
|
||||
|
||||
move_store_race(imap, imap_check).await;
|
||||
}
|
||||
|
||||
async fn move_store_race(imap: &mut ImapConnection, imap_check: &mut ImapConnection) {
|
||||
const RACE_MESSAGES: usize = 10;
|
||||
const RACE_ROUNDS: usize = 20;
|
||||
|
||||
// A MOVE that loses a race with a STORE on the same messages in another
|
||||
// session is retried instead of failing with CONTACTADMIN
|
||||
imap.send_ok("CREATE \"Race Left\"").await;
|
||||
imap.send_ok("CREATE \"Race Right\"").await;
|
||||
for i in 0..RACE_MESSAGES {
|
||||
imap.append(
|
||||
"Race Left",
|
||||
&format!("From: [email protected]\r\nSubject: Move race {i}\r\n\r\nrace\r\n"),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
for round in 0..RACE_ROUNDS {
|
||||
let (src, dest, store) = if round % 2 == 0 {
|
||||
("Race Left", "Race Right", "UID STORE 1:* +FLAGS (\\Seen)")
|
||||
} else {
|
||||
("Race Right", "Race Left", "UID STORE 1:* -FLAGS (\\Seen)")
|
||||
};
|
||||
imap.send_ok(&format!("SELECT \"{src}\"")).await;
|
||||
imap_check.send_ok(&format!("SELECT \"{src}\"")).await;
|
||||
|
||||
// The STORE may lose the race instead, so only the MOVE is checked
|
||||
imap.send(&format!("UID MOVE 1:* \"{dest}\"")).await;
|
||||
imap_check.send(store).await;
|
||||
let (moved, _) = tokio::join!(
|
||||
imap.assert_read(Type::Tagged, ResponseType::Ok),
|
||||
imap_check.read(Type::Tagged)
|
||||
);
|
||||
moved.assert_contains("COPYUID");
|
||||
|
||||
imap.send(&format!("STATUS \"{dest}\" (MESSAGES)")).await;
|
||||
imap.assert_read(Type::Tagged, ResponseType::Ok)
|
||||
.await
|
||||
.assert_contains(&format!("(MESSAGES {RACE_MESSAGES})"));
|
||||
}
|
||||
|
||||
// Restore the state the following tests expect
|
||||
imap.send_ok("SELECT \"Burrata al Tartufo\"").await;
|
||||
imap_check.send_ok("SELECT \"Burrata al Tartufo\"").await;
|
||||
imap.send_ok("DELETE \"Race Left\"").await;
|
||||
imap.send_ok("DELETE \"Race Right\"").await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user