Skip to content

Commit

Permalink
Refactor async test cases to use actix_rt macro
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjpotts committed Sep 23, 2023
1 parent af2c17f commit 1172d92
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
8 changes: 2 additions & 6 deletions ipfs-api/tests/test_basic_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ mod test_support;
use test_support::client::{build_client, wait_for_server};
use test_support::container::{IpfsContainer, NginxContainer};
use test_support::images;
use test_support::rt::run_async;

use ipfs_api_versions::test_current_image;

#[test_current_image]
fn test_basic_auth(image_name: &str, image_tag: &str) {
run_async(run_test(image_name, image_tag));
}

async fn run_test(image_name: &str, image_tag: &str) {
#[actix_rt::test]
async fn test_basic_auth(image_name: &str, image_tag: &str) {
let expected_version = images::extract_version(image_tag);

let container = IpfsContainer::new("test_basic_auth_ipfs", image_name, image_tag)
Expand Down
8 changes: 2 additions & 6 deletions ipfs-api/tests/test_get_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ mod test_support;
use test_support::client::{build_client, wait_for_server};
use test_support::container::IpfsContainer;
use test_support::images;
use test_support::rt::run_async;

use ipfs_api_versions::test_supported_images;

#[test_supported_images]
fn test_get_version(image_name: &str, image_tag: &str) {
run_async(run_test(image_name, image_tag));
}

async fn run_test(image_name: &str, image_tag: &str) {
#[actix_rt::test]
async fn test_get_version(image_name: &str, image_tag: &str) {
let expected_version = images::extract_version(image_tag);

let container_name = format!("test_get_version_{}", expected_version.replace('.', "-"));
Expand Down
1 change: 0 additions & 1 deletion ipfs-api/tests/test_support/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ pub mod client;
pub mod container;
pub mod errors;
pub mod images;
pub mod rt;
17 changes: 0 additions & 17 deletions ipfs-api/tests/test_support/rt.rs

This file was deleted.

0 comments on commit 1172d92

Please sign in to comment.