Skip to content

Commit 6e6e97c

Browse files
authored
Merge pull request #138 from iamjpotts/20230922-refactor-async-testcase
Refactor async test cases to use actix macro
2 parents f4d40ee + 1172d92 commit 6e6e97c

4 files changed

Lines changed: 4 additions & 30 deletions

File tree

ipfs-api/tests/test_basic_auth.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ mod test_support;
1111
use test_support::client::{build_client, wait_for_server};
1212
use test_support::container::{IpfsContainer, NginxContainer};
1313
use test_support::images;
14-
use test_support::rt::run_async;
1514

1615
use ipfs_api_versions::test_current_image;
1716

1817
#[test_current_image]
19-
fn test_basic_auth(image_name: &str, image_tag: &str) {
20-
run_async(run_test(image_name, image_tag));
21-
}
22-
23-
async fn run_test(image_name: &str, image_tag: &str) {
18+
#[actix_rt::test]
19+
async fn test_basic_auth(image_name: &str, image_tag: &str) {
2420
let expected_version = images::extract_version(image_tag);
2521

2622
let container = IpfsContainer::new("test_basic_auth_ipfs", image_name, image_tag)

ipfs-api/tests/test_get_version.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ mod test_support;
1111
use test_support::client::{build_client, wait_for_server};
1212
use test_support::container::IpfsContainer;
1313
use test_support::images;
14-
use test_support::rt::run_async;
1514

1615
use ipfs_api_versions::test_supported_images;
1716

1817
#[test_supported_images]
19-
fn test_get_version(image_name: &str, image_tag: &str) {
20-
run_async(run_test(image_name, image_tag));
21-
}
22-
23-
async fn run_test(image_name: &str, image_tag: &str) {
18+
#[actix_rt::test]
19+
async fn test_get_version(image_name: &str, image_tag: &str) {
2420
let expected_version = images::extract_version(image_tag);
2521

2622
let container_name = format!("test_get_version_{}", expected_version.replace('.', "-"));

ipfs-api/tests/test_support/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ pub mod client;
1414
pub mod container;
1515
pub mod errors;
1616
pub mod images;
17-
pub mod rt;

ipfs-api/tests/test_support/rt.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)