mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-24 16:14:48 +01:00
test: show for which test workspace was
basically fixtures leak workspaces when errors occur, so to better debug what is happening every test now names its workspace. this is tedious and should probably be removed eventually but for now it helps a ton
This commit is contained in:
parent
752a682efc
commit
cd4e09c1cd
3 changed files with 12 additions and 12 deletions
|
@ -3,7 +3,7 @@ use super::{assert_or_err, fixtures::{ScopedFixture, WorkspaceFixture}};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_buffer_search() {
|
async fn test_buffer_search() {
|
||||||
WorkspaceFixture::one("alice")
|
WorkspaceFixture::one("alice", "test-buffer-search")
|
||||||
.with(|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|
.with(|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|
||||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||||
let workspace_alice = workspace_alice.clone();
|
let workspace_alice = workspace_alice.clone();
|
||||||
|
@ -23,7 +23,7 @@ async fn test_buffer_search() {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_send_operation() {
|
async fn test_send_operation() {
|
||||||
WorkspaceFixture::two("alice", "bob")
|
WorkspaceFixture::two("alice", "bob", "test-send-operation")
|
||||||
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
||||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||||
let workspace_alice = workspace_alice.clone();
|
let workspace_alice = workspace_alice.clone();
|
||||||
|
@ -53,7 +53,7 @@ async fn test_send_operation() {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_content_converges() {
|
async fn test_content_converges() {
|
||||||
WorkspaceFixture::two("alice", "bob")
|
WorkspaceFixture::two("alice", "bob", "test-content-converges")
|
||||||
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
||||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||||
let workspace_alice = workspace_alice.clone();
|
let workspace_alice = workspace_alice.clone();
|
||||||
|
|
|
@ -89,19 +89,19 @@ impl WorkspaceFixture {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn one(user: &str) -> Self {
|
pub fn one(user: &str, ws: &str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
user: user.to_string(),
|
user: user.to_string(),
|
||||||
invite: None,
|
invite: None,
|
||||||
workspace: uuid::Uuid::new_v4().to_string(),
|
workspace: format!("{ws}-{}", uuid::Uuid::new_v4()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn two(user: &str, invite: &str) -> Self {
|
pub fn two(user: &str, invite: &str, ws: &str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
user: user.to_string(),
|
user: user.to_string(),
|
||||||
invite: Some(invite.to_string()),
|
invite: Some(invite.to_string()),
|
||||||
workspace: uuid::Uuid::new_v4().to_string(),
|
workspace: format!("{ws}-{}", uuid::Uuid::new_v4()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ use super::{assert_or_err, fixtures::{ClientFixture, ScopedFixture, WorkspaceFix
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn cannot_delete_others_workspaces() {
|
async fn cannot_delete_others_workspaces() {
|
||||||
WorkspaceFixture::two("alice", "bob")
|
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-workspaces")
|
||||||
.with(|((_, ws_alice), (client_bob, _))| {
|
.with(|((_, ws_alice), (client_bob, _))| {
|
||||||
let ws_alice = ws_alice.clone();
|
let ws_alice = ws_alice.clone();
|
||||||
let client_bob = client_bob.clone();
|
let client_bob = client_bob.clone();
|
||||||
|
@ -20,7 +20,7 @@ async fn cannot_delete_others_workspaces() {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_buffer_create() {
|
async fn test_buffer_create() {
|
||||||
WorkspaceFixture::one("alice")
|
WorkspaceFixture::one("alice", "test-buffer-create")
|
||||||
.with(|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|
.with(|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|
||||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||||
let workspace_alice = workspace_alice.clone();
|
let workspace_alice = workspace_alice.clone();
|
||||||
|
@ -38,7 +38,7 @@ async fn test_buffer_create() {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_cant_create_buffer_twice() {
|
async fn test_cant_create_buffer_twice() {
|
||||||
WorkspaceFixture::one("alice")
|
WorkspaceFixture::one("alice", "test-cant-create-buffer-twice")
|
||||||
.with(|(_, ws): &mut (crate::Client, crate::Workspace)| {
|
.with(|(_, ws): &mut (crate::Client, crate::Workspace)| {
|
||||||
let ws = ws.clone();
|
let ws = ws.clone();
|
||||||
async move {
|
async move {
|
||||||
|
@ -56,7 +56,7 @@ async fn test_cant_create_buffer_twice() {
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[ignore] // TODO server has no concept of buffer ownership!
|
#[ignore] // TODO server has no concept of buffer ownership!
|
||||||
async fn cannot_delete_others_buffers() {
|
async fn cannot_delete_others_buffers() {
|
||||||
WorkspaceFixture::two("alice", "bob")
|
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-buffers")
|
||||||
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
||||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||||
let workspace_alice = workspace_alice.clone();
|
let workspace_alice = workspace_alice.clone();
|
||||||
|
@ -76,7 +76,7 @@ async fn test_workspace_interactions() {
|
||||||
if let Err(e) = async {
|
if let Err(e) = async {
|
||||||
let client_alice = ClientFixture::of("alice").setup().await?;
|
let client_alice = ClientFixture::of("alice").setup().await?;
|
||||||
let client_bob = ClientFixture::of("bob").setup().await?;
|
let client_bob = ClientFixture::of("bob").setup().await?;
|
||||||
let workspace_name = uuid::Uuid::new_v4().to_string();
|
let workspace_name = format!("test-workspace-interactions-{}", uuid::Uuid::new_v4().to_string());
|
||||||
|
|
||||||
client_alice.create_workspace(&workspace_name).await?;
|
client_alice.create_workspace(&workspace_name).await?;
|
||||||
let owned_workspaces = client_alice.fetch_owned_workspaces().await?;
|
let owned_workspaces = client_alice.fetch_owned_workspaces().await?;
|
||||||
|
|
Loading…
Reference in a new issue