From c4b78e857576e4adc4e1f60f290602f93d4d35f3 Mon Sep 17 00:00:00 2001 From: Antonios Barotsis Date: Wed, 1 May 2024 00:57:20 +0200 Subject: [PATCH] Temporarily "fix" tests --- src/api_keys.rs | 2 ++ src/audiences.rs | 2 ++ src/contacts.rs | 2 ++ src/emails.rs | 6 ++++++ src/lib.rs | 3 +++ 5 files changed, 15 insertions(+) diff --git a/src/api_keys.rs b/src/api_keys.rs index db6f24d..0e479fc 100644 --- a/src/api_keys.rs +++ b/src/api_keys.rs @@ -209,6 +209,8 @@ mod test { // Delete. resend.api_keys.delete(&id).await?; + std::thread::sleep(std::time::Duration::from_secs(1)); + Ok(()) } } diff --git a/src/audiences.rs b/src/audiences.rs index 36b2c08..408bc39 100644 --- a/src/audiences.rs +++ b/src/audiences.rs @@ -180,6 +180,8 @@ mod test { let deleted = resend.audiences.delete(&id).await?; assert!(deleted); + std::thread::sleep(std::time::Duration::from_secs(1)); + Ok(()) } } diff --git a/src/contacts.rs b/src/contacts.rs index 73ab834..be4a89e 100644 --- a/src/contacts.rs +++ b/src/contacts.rs @@ -321,6 +321,8 @@ mod test { // Delete audience. let _ = resend.audiences.delete(&audience_id).await?; + std::thread::sleep(std::time::Duration::from_secs(1)); + Ok(()) } } diff --git a/src/emails.rs b/src/emails.rs index 8e85250..cfde144 100644 --- a/src/emails.rs +++ b/src/emails.rs @@ -399,6 +399,9 @@ mod test { .with_tag("Welcome"); let _ = resend.emails.send(email).await?; + + std::thread::sleep(std::time::Duration::from_secs(1)); + Ok(()) } @@ -415,6 +418,9 @@ mod test { .with_tag("Welcome"); let _ = resend.emails.send(email)?; + + std::thread::sleep(std::time::Duration::from_secs(1)); + Ok(()) } } diff --git a/src/lib.rs b/src/lib.rs index 6b9fbca..761022a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,9 @@ // FIXME: Tests can fail due to rate limit constraints (max 10 req/s). Running the tests on one // thread seems to work for now but this is just a workaround. For now, an alias is provided // for `cargo t` which automatically passes `-- --test-threads=1` to the tests. +// Edit: Somewhat unsurprisingly, this sometimes fails in CI because the Linux image just runs +// faster so additional thread sleeps were added, these need to be removed when (if?) this is +// solved. pub use client::Client; pub(crate) use config::Config;