Skip to content

Commit

Permalink
Temporarily "fix" tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoniosBarotsis committed Apr 30, 2024
1 parent 302f403 commit c4b78e8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ mod test {
// Delete.
resend.api_keys.delete(&id).await?;

std::thread::sleep(std::time::Duration::from_secs(1));

Ok(())
}
}
2 changes: 2 additions & 0 deletions src/audiences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}
2 changes: 2 additions & 0 deletions src/contacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}
6 changes: 6 additions & 0 deletions src/emails.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand All @@ -415,6 +418,9 @@ mod test {
.with_tag("Welcome");

let _ = resend.emails.send(email)?;

std::thread::sleep(std::time::Duration::from_secs(1));

Ok(())
}
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c4b78e8

Please sign in to comment.