Skip to content
Snippets Groups Projects
Commit b3eee0ae authored by Robin Appelman's avatar Robin Appelman
Browse files

make tests not hang?


Signed-off-by: default avatarRobin Appelman <robin@icewind.nl>
parent ea93b6f4
No related branches found
No related tags found
No related merge requests found
......@@ -259,7 +259,7 @@ impl ServerHandle {
}
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_auth() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -272,7 +272,7 @@ async fn test_auth() {
assert_next_message(&mut client, "authenticated").await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_auth_failure() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -302,12 +302,13 @@ async fn assert_next_message(
#[track_caller]
async fn assert_no_message(client: &mut WebSocketStream<MaybeTlsStream<TcpStream>>) {
sleep(Duration::from_millis(5)).await;
assert!(timeout(Duration::from_millis(10), client.next())
.await
.is_err());
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_activity() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -322,9 +323,10 @@ async fn test_notify_activity() {
.unwrap();
assert_next_message(&mut client, "notify_activity").await;
std::mem::forget(services);
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_activity_other_user() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -341,7 +343,7 @@ async fn test_notify_activity_other_user() {
assert_no_message(&mut client).await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_file() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -364,7 +366,7 @@ async fn test_notify_file() {
assert_next_message(&mut client, "notify_file").await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_file_different_storage() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -387,7 +389,7 @@ async fn test_notify_file_different_storage() {
assert_no_message(&mut client).await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_file_multiple() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -421,7 +423,7 @@ async fn test_notify_file_multiple() {
assert_no_message(&mut client3).await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_pre_auth() {
let services = Services::new().await;
......@@ -446,7 +448,7 @@ async fn test_pre_auth() {
assert_next_message(&mut client, "notify_activity").await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_notification() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -466,7 +468,7 @@ async fn test_notify_notification() {
assert_no_message(&mut client2).await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_share() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -486,7 +488,7 @@ async fn test_notify_share() {
assert_no_message(&mut client2).await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_group() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -509,7 +511,7 @@ async fn test_notify_group() {
assert_no_message(&mut client2).await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_custom() {
let services = Services::new().await;
services.add_user("foo", "bar");
......@@ -532,7 +534,7 @@ async fn test_notify_custom() {
assert_no_message(&mut client2).await;
}
#[tokio::test(flavor = "multi_thread")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_notify_custom_body() {
let services = Services::new().await;
services.add_user("foo", "bar");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment