fix test bug with tempdir

This commit is contained in:
mpostma
2021-03-11 17:59:47 +01:00
parent 2ae90f9c5d
commit 1fad72e019
7 changed files with 188 additions and 161 deletions

View File

@ -12,15 +12,17 @@ use super::service::Service;
pub struct Server {
pub service: Service,
// hod ownership to the tempdir while we use the server instance.
_dir: tempdir::TempDir,
}
impl Server {
pub async fn new() -> Self {
let tmp_dir = TempDir::new("meilisearch").unwrap();
let dir = TempDir::new("meilisearch").unwrap();
let opt = Opt {
db_path: tmp_dir.path().join("db"),
dumps_dir: tmp_dir.path().join("dump"),
db_path: dir.path().join("db"),
dumps_dir: dir.path().join("dump"),
dump_batch_size: 16,
http_addr: "127.0.0.1:7700".to_owned(),
master_key: None,
@ -55,6 +57,7 @@ impl Server {
Server {
service,
_dir: dir,
}
}

View File

@ -35,7 +35,8 @@ async fn update_settings_unknown_field() {
async fn test_partial_update() {
let server = Server::new().await;
let index = server.index("test");
index.update_settings(json!({"displayedAttributes": ["foo"]})).await;
let (response, _code) = index.update_settings(json!({"displayedAttributes": ["foo"]})).await;
println!("response: {}", response);
index.wait_update_id(0).await;
let (response, code) = index.settings().await;
assert_eq!(code, 200);