|
|
|
@ -34,7 +34,8 @@ pub struct FSStore { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl FSStore { |
|
|
|
|
pub fn new(dir_path: PathBuf) -> io::Result<Self> { |
|
|
|
|
pub fn new(config: &origin::Config) -> io::Result<Self> { |
|
|
|
|
let dir_path = config.store_dir_path.clone(); |
|
|
|
|
fs::create_dir_all(&dir_path)?; |
|
|
|
|
Ok(Self { |
|
|
|
|
dir_path, |
|
|
|
@ -336,13 +337,16 @@ impl super::Store for FSStore { |
|
|
|
|
|
|
|
|
|
#[cfg(test)] |
|
|
|
|
mod tests { |
|
|
|
|
use crate::origin::{self, Store}; |
|
|
|
|
use crate::origin::{self, Config, Store}; |
|
|
|
|
use futures::StreamExt; |
|
|
|
|
use tempdir::TempDir; |
|
|
|
|
|
|
|
|
|
#[tokio::test] |
|
|
|
|
async fn basic() { |
|
|
|
|
let tmp_dir = TempDir::new("origin_store_git").unwrap(); |
|
|
|
|
let config = Config { |
|
|
|
|
store_dir_path: tmp_dir.path().to_path_buf(), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let curr_dir = format!("file://{}", std::env::current_dir().unwrap().display()); |
|
|
|
|
|
|
|
|
@ -356,7 +360,7 @@ mod tests { |
|
|
|
|
branch_name: String::from("some_other_branch"), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let store = super::FSStore::new(tmp_dir.path().to_path_buf()).expect("store created"); |
|
|
|
|
let store = super::FSStore::new(&config).expect("store created"); |
|
|
|
|
|
|
|
|
|
store.sync(&descr).expect("sync should succeed"); |
|
|
|
|
store.sync(&descr).expect("second sync should succeed"); |
|
|
|
|