From d470cb646e9299cf643d429b387ff392c602ab03 Mon Sep 17 00:00:00 2001 From: Magic Len Date: Tue, 15 Jun 2021 23:35:32 +0800 Subject: [PATCH] fix tests --- .github/workflows/ci-version.yml | 1 + .github/workflows/ci.yml | 1 + src/lib.rs | 2 -- src/rocket_mounts/api/mod.rs | 10 +++++----- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-version.yml b/.github/workflows/ci-version.yml index 9aefe07..aa3e4f9 100644 --- a/.github/workflows/ci-version.yml +++ b/.github/workflows/ci-version.yml @@ -16,6 +16,7 @@ jobs: os: - ubuntu-latest toolchain: + - stable - nightly target: - x86_64-unknown-linux-gnu diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 978e3c8..fb50c7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: os: - ubuntu-latest toolchain: + - stable - nightly target: - x86_64-unknown-linux-gnu diff --git a/src/lib.rs b/src/lib.rs index 4dedaab..4a9e969 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(decl_macro)] - extern crate mprober_lib; extern crate byte_unit; diff --git a/src/rocket_mounts/api/mod.rs b/src/rocket_mounts/api/mod.rs index cc5f35d..af3b707 100644 --- a/src/rocket_mounts/api/mod.rs +++ b/src/rocket_mounts/api/mod.rs @@ -974,13 +974,13 @@ mod test { use std::time::Duration; use rocket::http::Header; - use rocket::local::Client; + use rocket::local::blocking::Client; const TEST_DETECT_INTERVAL: u64 = 1000; const TEST_AUTH_KEY: &str = "magic"; - fn create_basic_rocket(has_auth_key: bool) -> Rocket { - let rocket = rocket::ignite() + fn create_basic_rocket(has_auth_key: bool) -> Rocket { + let rocket = rocket::build() .manage(super::super::DetectInterval(Duration::from_millis(TEST_DETECT_INTERVAL))); if has_auth_key { @@ -994,7 +994,7 @@ mod test { fn test_no_need_auth() { let rocket = create_basic_rocket(false).mount("/api", routes![hostname, hostname_401]); - let client = Client::new(rocket).unwrap(); + let client = Client::tracked(rocket).unwrap(); { let mut req = client.get("/api/hostname"); @@ -1019,7 +1019,7 @@ mod test { fn test_need_auth() { let rocket = create_basic_rocket(true).mount("/api", routes![hostname, hostname_401]); - let client = Client::new(rocket).unwrap(); + let client = Client::tracked(rocket).unwrap(); { let mut req = client.get("/api/hostname");