Skip to content

Commit

Permalink
fixed parallel test run drop
Browse files Browse the repository at this point in the history
  • Loading branch information
Dejan Kos committed Sep 19, 2020
1 parent e64992a commit ca36028
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Data {
}

pub struct DbManager {
db_cfg: DbConfig,
pub db_cfg: DbConfig,
root_db: Db,
dbs: SafeRW<HashMap<String, Db>>,
tx: Mutex<Sender<BoxedFnOnce>>,
Expand Down
16 changes: 8 additions & 8 deletions src/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::{fs, thread};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::Duration;
use std::{fs, thread};

use actix_web::{App, Error, test, web};
use actix_web::dev::ServiceResponse;
use actix_web::http::StatusCode;
use actix_web::rt as actix_rt;
use actix_web::{test, web, App, Error};

use crate::config::{DbConfig, RocksDbConfig};
use crate::conversion::bytes_to_str;
Expand Down Expand Up @@ -37,7 +37,7 @@ impl DbConfig {

impl Drop for DbManager {
fn drop(&mut self) {
let _ = fs::remove_dir_all(RocksDbConfig::default().path);
let _ = fs::remove_dir_all(self.db_cfg.path());
}
}

Expand All @@ -53,7 +53,7 @@ async fn should_open_and_close_db() -> Result<(), Error> {
.service(close)
.service(exists),
)
.await;
.await;

let req = test::TestRequest::post().uri("/test_db").to_request();
let res = test::call_service(&mut app, req).await;
Expand Down Expand Up @@ -98,7 +98,7 @@ async fn should_add_and_delete_record() -> Result<(), Error> {
.service(remove)
.service(close),
)
.await;
.await;

let req = test::TestRequest::post().uri("/test_db").to_request();
let res = test::call_service(&mut app, req).await;
Expand Down Expand Up @@ -159,7 +159,7 @@ async fn should_expire_record() -> Result<(), Error> {
.service(remove)
.service(close),
)
.await;
.await;

let req = test::TestRequest::post().uri("/test_db").to_request();
let res = test::call_service(&mut app, req).await;
Expand Down Expand Up @@ -219,7 +219,7 @@ async fn should_check_service_status() -> Result<(), Error> {
.app_data(web::Data::new(db_manager))
.service(health),
)
.await;
.await;

let req = test::TestRequest::get().uri("/health").to_request();
let res = test::call_service(&mut app, req).await;
Expand All @@ -243,7 +243,7 @@ async fn should_handle_404() -> Result<(), Error> {
.app_data(web::Data::new(db_manager))
.service(exists),
)
.await;
.await;

let req = test::TestRequest::put().uri("/test_db").to_request(); // no put handles
let res = test::call_service(&mut app, req).await;
Expand Down

0 comments on commit ca36028

Please sign in to comment.