diff --git a/dev.env b/dev.env index b08fced2c..c54d08cb1 100644 --- a/dev.env +++ b/dev.env @@ -91,6 +91,7 @@ APPFLOWY_S3_ACCESS_KEY=${AWS_ACCESS_KEY} APPFLOWY_S3_SECRET_KEY=${AWS_SECRET} APPFLOWY_S3_BUCKET=appflowy #APPFLOWY_S3_REGION=us-east-1 +APPFLOWY_S3_PRESIGNED_URL_ENDPOINT=http://localhost/minio-api # AppFlowy Cloud Mailer # Note that smtps (TLS) is always required, even for ports other than 465 diff --git a/tests/workspace/import_test.rs b/tests/workspace/import_test.rs index cec651202..97b527cca 100644 --- a/tests/workspace/import_test.rs +++ b/tests/workspace/import_test.rs @@ -6,29 +6,6 @@ use collab_folder::ViewLayout; use std::path::PathBuf; use std::time::Duration; -// #[tokio::test] -// async fn import_blog_post_four_times_test() { -// let mut handles = vec![]; -// // Simulate 4 clients, each uploading 3 files concurrently. -// for _ in 0..4 { -// let handle = tokio::spawn(async { -// let client = TestClient::new_user().await; -// for _ in 0..3 { -// let _ = upload_file(&client, "blog_post.zip", None).await.unwrap(); -// } -// -// // the default concurrency limit is 3, so the fourth import should fail -// upload_file(&client, "blog_post.zip", None).await.unwrap(); -// wait_until_num_import_task_complete(&client, 3).await; -// }); -// handles.push(handle); -// } -// -// for result in join_all(handles).await { -// result.unwrap(); -// } -// } - #[tokio::test] async fn import_blog_post_test() { // Step 1: Import the blog post zip @@ -210,15 +187,15 @@ async fn upload_file( upload_after_secs: Option, ) -> Result<(), Error> { let file_path = PathBuf::from(format!("tests/workspace/asset/{name}")); - let mut url = client + let url = client .api_client .create_import(&file_path) .await? .presigned_url; - if url.contains("http://minio:9000") { - url = url.replace("http://minio:9000", "http://localhost/minio"); - } + // if url.contains("http://minio:9000") { + // url = url.replace("http://minio:9000", "http://localhost/minio"); + // } if let Some(secs) = upload_after_secs { tokio::time::sleep(Duration::from_secs(secs)).await; @@ -234,8 +211,14 @@ async fn upload_file( // upload_after_secs: simulate the delay of uploading the file async fn import_notion_zip_until_complete(name: &str) -> (TestClient, String) { let client = TestClient::new_user().await; - let file_path = PathBuf::from(format!("tests/workspace/asset/{name}")); - client.api_client.import_file(&file_path).await.unwrap(); + + // Uncomment the following lines to use the predicated upload file API. + // Currently, we use `upload_file` to send a file to appflowy_worker, which then + // processes the upload task. + // let file_path = PathBuf::from(format!("tests/workspace/asset/{name}")); + // client.api_client.import_file(&file_path).await.unwrap(); + upload_file(&client, name, None).await.unwrap(); + let default_workspace_id = client.workspace_id().await; // when importing a file, the workspace for the file should be created and it's