From bf9ea18d671bd2914faea778394b37369f08d743 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 5 Nov 2024 01:42:21 +0100 Subject: [PATCH] test: dont use ws fixture coz leave wont work --- src/tests/client.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/tests/client.rs b/src/tests/client.rs index fbdf648..1b0d362 100644 --- a/src/tests/client.rs +++ b/src/tests/client.rs @@ -115,14 +115,23 @@ async fn test_lookup_after_leave() { #[tokio::test] async fn test_attach_after_leave() { super::fixture! { - WorkspaceFixture::one("alice", "test-attach-after-leave") => |client, workspace| { - let ws_name = workspace.id(); - drop(workspace); - client.leave_workspace(&ws_name); + ClientFixture::of("alice") => |client| { + let ws_name = uuid::Uuid::new_v4().to_string(); + client.create_workspace(&ws_name).await?; + + let could_attach = client.attach_workspace(&ws_name).await.is_ok(); + let clean_leave = client.leave_workspace(&ws_name); // TODO this is very server specific! disconnect may be instant or caught with next // keepalive, let's arbitrarily say that after 20 seconds we should have been disconnected tokio::time::sleep(std::time::Duration::from_secs(20)).await; - client.attach_workspace(&ws_name).await?; + let could_attach_again = client.attach_workspace(&ws_name).await; + let could_delete = client.delete_workspace(&ws_name).await; + + assert_or_err!(could_attach); + assert_or_err!(clean_leave); + could_attach_again?; + could_delete?; + Ok(()) } }