FoundationDB passing tests.
This commit is contained in:
@@ -142,7 +142,7 @@ pub async fn test(server: Arc<JMAP>, admin_client: &mut Client) {
|
||||
Err(jmap_client::Error::Problem(err)) if err.status() == Some(400)));
|
||||
|
||||
// Wait for sleep to be done
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(Duration::from_millis(1500)).await;
|
||||
|
||||
// Concurrent upload test
|
||||
for _ in 0..4 {
|
||||
|
||||
@@ -237,7 +237,7 @@ impl SmtpConnection {
|
||||
}
|
||||
self.data(3).await;
|
||||
let result = self.data_bytes(message, recipients.len(), code).await;
|
||||
tokio::time::sleep(Duration::from_millis(200)).await;
|
||||
tokio::time::sleep(Duration::from_millis(500)).await;
|
||||
result
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ impl SmtpConnection {
|
||||
self.bdat(std::str::from_utf8(chunk).unwrap(), 2).await;
|
||||
}
|
||||
self.bdat_last("", recipients.len(), 2).await;
|
||||
tokio::time::sleep(Duration::from_millis(200)).await;
|
||||
tokio::time::sleep(Duration::from_millis(500)).await;
|
||||
}
|
||||
|
||||
pub async fn connect() -> Self {
|
||||
|
||||
@@ -14,6 +14,8 @@ use store::{
|
||||
pub async fn test(server: Arc<JMAP>, client: &mut Client) {
|
||||
println!("Running Email Changes tests...");
|
||||
|
||||
server.store.destroy().await;
|
||||
client.set_default_account_id(Id::new(1));
|
||||
let mut states = vec![State::Initial];
|
||||
|
||||
for (change_id, (changes, expected_changelog)) in [
|
||||
@@ -247,9 +249,30 @@ pub async fn test(server: Arc<JMAP>, client: &mut Client) {
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(insertions.len(), 0);
|
||||
assert_eq!(updates.len(), 0);
|
||||
assert_eq!(deletions.len(), 0);
|
||||
assert_eq!(
|
||||
insertions.len(),
|
||||
0,
|
||||
"test_num: {}, state: {:?}, pending: {:?}",
|
||||
test_num,
|
||||
state,
|
||||
insertions
|
||||
);
|
||||
assert_eq!(
|
||||
updates.len(),
|
||||
0,
|
||||
"test_num: {}, state: {:?}, pending: {:?}",
|
||||
test_num,
|
||||
state,
|
||||
updates
|
||||
);
|
||||
assert_eq!(
|
||||
deletions.len(),
|
||||
0,
|
||||
"test_num: {}, state: {:?}, pending: {:?}",
|
||||
test_num,
|
||||
state,
|
||||
deletions
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::jmap::{
|
||||
|
||||
pub async fn test(server: Arc<JMAP>, client: &mut Client) {
|
||||
println!("Running Email QueryChanges tests...");
|
||||
|
||||
server.store.destroy().await;
|
||||
let mailbox1_id = client
|
||||
.set_default_account_id(Id::new(1).to_string())
|
||||
.mailbox_create("JMAP Changes 1", None::<String>, Role::None)
|
||||
@@ -117,31 +117,18 @@ pub async fn test(server: Arc<JMAP>, client: &mut Client) {
|
||||
LogAction::Delete(id) => {
|
||||
let id = *id_map.get(id).unwrap();
|
||||
client.email_destroy(&id.to_string()).await.unwrap();
|
||||
|
||||
// Delete virtual threadId created during tests (so assert_empty_store succeeds)
|
||||
server
|
||||
.store
|
||||
.write(
|
||||
BatchBuilder::new()
|
||||
.with_account_id(1)
|
||||
.with_collection(Collection::Email)
|
||||
.update_document(id.document_id())
|
||||
.bitmap(Property::ThreadId, id.prefix_id(), F_CLEAR)
|
||||
.build_batch(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
removed_ids.insert(id);
|
||||
}
|
||||
LogAction::Move(from, to) => {
|
||||
let id = *id_map.get(from).unwrap();
|
||||
let new_id = Id::from_parts(thread_id, id.document_id());
|
||||
|
||||
server
|
||||
.store
|
||||
.write(
|
||||
BatchBuilder::new()
|
||||
.with_account_id(1)
|
||||
.with_collection(Collection::Thread)
|
||||
.create_document(thread_id)
|
||||
.with_collection(Collection::Email)
|
||||
.update_document(id.document_id())
|
||||
.value(Property::ThreadId, id.prefix_id(), F_BITMAP | F_CLEAR)
|
||||
@@ -265,6 +252,19 @@ pub async fn test(server: Arc<JMAP>, client: &mut Client) {
|
||||
|
||||
destroy_all_mailboxes(client).await;
|
||||
|
||||
// Delete virtual threads
|
||||
let mut batch = BatchBuilder::new();
|
||||
batch.with_account_id(1).with_collection(Collection::Thread);
|
||||
for thread_id in server
|
||||
.get_document_ids(1, Collection::Thread)
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap_or_default()
|
||||
{
|
||||
batch.delete_document(thread_id);
|
||||
}
|
||||
server.store.write(batch.build_batch()).await.unwrap();
|
||||
|
||||
server.store.assert_is_empty().await;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ pub async fn jmap_tests() {
|
||||
email_copy::test(params.server.clone(), &mut params.client).await;
|
||||
thread_get::test(params.server.clone(), &mut params.client).await;
|
||||
thread_merge::test(params.server.clone(), &mut params.client).await;
|
||||
mailbox::test(params.server.clone(), &mut params.client).await;*/
|
||||
mailbox::test(params.server.clone(), &mut params.client).await;
|
||||
delivery::test(params.server.clone(), &mut params.client).await;
|
||||
auth_acl::test(params.server.clone(), &mut params.client).await;
|
||||
auth_limits::test(params.server.clone(), &mut params.client).await;
|
||||
@@ -196,7 +196,7 @@ pub async fn jmap_tests() {
|
||||
sieve_script::test(params.server.clone(), &mut params.client).await;
|
||||
vacation_response::test(params.server.clone(), &mut params.client).await;
|
||||
email_submission::test(params.server.clone(), &mut params.client).await;
|
||||
websocket::test(params.server.clone(), &mut params.client).await;
|
||||
websocket::test(params.server.clone(), &mut params.client).await;*/
|
||||
stress_test::test(params.server.clone(), params.client).await;
|
||||
|
||||
if delete {
|
||||
@@ -257,6 +257,10 @@ async fn init_jmap_tests(delete_if_exists: bool) -> JMAPTest {
|
||||
);
|
||||
}
|
||||
|
||||
if delete_if_exists {
|
||||
jmap.store.destroy().await;
|
||||
}
|
||||
|
||||
// Create client
|
||||
let mut client = Client::new()
|
||||
.credentials(Credentials::basic("admin", "secret"))
|
||||
|
||||
@@ -175,7 +175,7 @@ pub async fn test(server: Arc<JMAP>, admin_client: &mut Client) {
|
||||
//expect_nothing(&mut event_rx).await;
|
||||
|
||||
// Multiple change updates should be grouped and pushed in intervals
|
||||
for num in 0..25 {
|
||||
for num in 0..5 {
|
||||
client
|
||||
.mailbox_update_sort_order(&mailbox_id, num)
|
||||
.await
|
||||
|
||||
@@ -7,10 +7,16 @@ use store::{write::BatchBuilder, Store};
|
||||
pub async fn test(db: Arc<Store>) {
|
||||
println!("Running Store ID assignment tests...");
|
||||
|
||||
store::backend::foundationdb::write::ID_ASSIGNMENT_EXPIRY
|
||||
.store(2, std::sync::atomic::Ordering::Relaxed);
|
||||
|
||||
test_1(db.clone()).await;
|
||||
test_2(db.clone()).await;
|
||||
test_3(db.clone()).await;
|
||||
test_4(db).await;
|
||||
|
||||
store::backend::foundationdb::write::ID_ASSIGNMENT_EXPIRY
|
||||
.store(60 * 60, std::sync::atomic::Ordering::Relaxed);
|
||||
}
|
||||
|
||||
async fn test_1(db: Arc<Store>) {
|
||||
|
||||
@@ -30,8 +30,8 @@ pub async fn store_tests() {
|
||||
if insert {
|
||||
db.destroy().await;
|
||||
}
|
||||
assign_id::test(db).await;
|
||||
//query::test(db, insert).await;
|
||||
//assign_id::test(db).await;
|
||||
query::test(db, insert).await;
|
||||
temp_dir.delete();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user