fix: wait for a second after duplication to workspace (#930)

* fix: wait for a second after duplication to workspace

* chore: rust lint
This commit is contained in:
Zack 2024-10-25 13:22:33 +08:00 committed by GitHub
parent e738508d79
commit 42bf807a8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 52 deletions

View File

@ -40,8 +40,8 @@ use database_entity::dto::{
QuerySnapshotParams, SnapshotData, UpdateCollabMemberParams, QuerySnapshotParams, SnapshotData, UpdateCollabMemberParams,
}; };
use shared_entity::dto::workspace_dto::{ use shared_entity::dto::workspace_dto::{
BlobMetadata, CollabResponse, WorkspaceMemberChangeset, WorkspaceMemberInvitation, BlobMetadata, CollabResponse, PublishedDuplicate, WorkspaceMemberChangeset,
WorkspaceSpaceUsage, WorkspaceMemberInvitation, WorkspaceSpaceUsage,
}; };
use shared_entity::response::AppResponseError; use shared_entity::response::AppResponseError;
@ -928,6 +928,28 @@ impl TestClient {
.await .await
.unwrap(); .unwrap();
} }
pub async fn duplicate_published_to_workspace(
&self,
dest_workspace_id: &str,
src_view_id: &str,
dest_view_id: &str,
) {
self
.api_client
.duplicate_published_to_workspace(
dest_workspace_id,
&PublishedDuplicate {
published_view_id: src_view_id.to_string(),
dest_view_id: dest_view_id.to_string(),
},
)
.await
.unwrap();
// wait a while for folder collab to be synced
tokio::time::sleep(Duration::from_secs(1)).await;
}
} }
pub async fn assert_server_snapshot( pub async fn assert_server_snapshot(

View File

@ -17,7 +17,6 @@ use collab_entity::CollabType;
use collab_folder::{CollabOrigin, Folder, UserId}; use collab_folder::{CollabOrigin, Folder, UserId};
use itertools::Itertools; use itertools::Itertools;
use shared_entity::dto::publish_dto::PublishDatabaseData; use shared_entity::dto::publish_dto::PublishDatabaseData;
use shared_entity::dto::workspace_dto::PublishedDuplicate;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
@ -784,16 +783,12 @@ async fn duplicate_to_workspace_references() {
// └── doc1 // └── doc1
// └── grid1 // └── grid1
client_2 client_2
.api_client
.duplicate_published_to_workspace( .duplicate_published_to_workspace(
&workspace_id_2, &workspace_id_2,
&PublishedDuplicate { &doc_2_view_id.to_string(),
published_view_id: doc_2_view_id.to_string(), &fv.view_id, // use the root view
dest_view_id: fv.view_id, // use the root view
},
) )
.await .await;
.unwrap();
let fv = client_2 let fv = client_2
.api_client .api_client
@ -874,16 +869,12 @@ async fn duplicate_to_workspace_doc_inline_database() {
// └── grid1 // └── grid1
// └── View of grid1 // └── View of grid1
client_2 client_2
.api_client
.duplicate_published_to_workspace( .duplicate_published_to_workspace(
&workspace_id_2, &workspace_id_2,
&PublishedDuplicate { &doc_3_view_id.to_string(),
published_view_id: doc_3_view_id.to_string(), &fv.view_id, // use the root view
dest_view_id: fv.view_id, // use the root view
},
) )
.await .await;
.unwrap();
{ {
let fv = client_2 let fv = client_2
@ -1036,16 +1027,12 @@ async fn duplicate_to_workspace_db_embedded_in_doc() {
// ├── Getting Started (existing) // ├── Getting Started (existing)
// └── db_with_embedded_db (inside should contain the database) // └── db_with_embedded_db (inside should contain the database)
client_2 client_2
.api_client
.duplicate_published_to_workspace( .duplicate_published_to_workspace(
&workspace_id_2, &workspace_id_2,
&PublishedDuplicate { &doc_with_embedded_db_view_id.to_string(),
published_view_id: doc_with_embedded_db_view_id.to_string(), &fv.view_id, // use the root view
dest_view_id: fv.view_id, // use the root view
},
) )
.await .await;
.unwrap();
{ {
let fv = client_2 let fv = client_2
@ -1141,16 +1128,12 @@ async fn duplicate_to_workspace_db_with_relation() {
// related-db cannot be child of db_with_rel_col because they dont share the same field // related-db cannot be child of db_with_rel_col because they dont share the same field
// and are 2 different databases, so we just put them in the root (dest_id) // and are 2 different databases, so we just put them in the root (dest_id)
client_2 client_2
.api_client
.duplicate_published_to_workspace( .duplicate_published_to_workspace(
&workspace_id_2, &workspace_id_2,
&PublishedDuplicate { &db_with_rel_col_view_id.to_string(),
published_view_id: db_with_rel_col_view_id.to_string(), &fv.view_id, // use the root view
dest_view_id: fv.view_id, // use the root view
},
) )
.await .await;
.unwrap();
{ {
let fv = client_2 let fv = client_2
@ -1230,16 +1213,12 @@ async fn duplicate_to_workspace_db_row_with_doc() {
// ├── Getting Started (existing) // ├── Getting Started (existing)
// └── db_with_row_doc // └── db_with_row_doc
client_2 client_2
.api_client
.duplicate_published_to_workspace( .duplicate_published_to_workspace(
&workspace_id_2, &workspace_id_2,
&PublishedDuplicate { &db_with_row_doc_view_id.to_string(),
published_view_id: db_with_row_doc_view_id.to_string(), &fv.view_id, // use the root view
dest_view_id: fv.view_id, // use the root view
},
) )
.await .await;
.unwrap();
{ {
let fv = client_2 let fv = client_2
@ -1313,16 +1292,12 @@ async fn duplicate_to_workspace_db_rel_self() {
.unwrap(); .unwrap();
client_2 client_2
.api_client
.duplicate_published_to_workspace( .duplicate_published_to_workspace(
&workspace_id_2, &workspace_id_2,
&PublishedDuplicate { &db_rel_self_view_id.to_string(),
published_view_id: db_rel_self_view_id.to_string(), &fv.view_id, // use the root view
dest_view_id: fv.view_id, // use the root view
},
) )
.await .await;
.unwrap();
let fv = client_2 let fv = client_2
.api_client .api_client
@ -1408,16 +1383,12 @@ async fn duplicate_to_workspace_inline_db_doc_with_relation() {
.unwrap(); .unwrap();
client_2 client_2
.api_client
.duplicate_published_to_workspace( .duplicate_published_to_workspace(
&workspace_id_2, &workspace_id_2,
&PublishedDuplicate { &doc_4_view_id.to_string(),
published_view_id: doc_4_view_id.to_string(), &fv.view_id, // use the root view
dest_view_id: fv.view_id, // use the root view
},
) )
.await .await;
.unwrap();
let fv = client_2 let fv = client_2
.api_client .api_client