test_repo_factory: use test factory for test fixtures

Summary: Use the test factory for test fixtures that are used in many existing tests.

Reviewed By: StanislavGlebik

Differential Revision: D27169432

fbshipit-source-id: bb3cbfa95b330cf6572d1009c507271a7b008dec
This commit is contained in:
Mark Juggurnauth-Thomas 2021-03-25 07:32:21 -07:00 committed by Facebook GitHub Bot
parent 0294b95c35
commit bcc69eed04
2 changed files with 12 additions and 11 deletions

View File

@ -8,7 +8,6 @@ license = "GPLv2+"
[dependencies]
anyhow = "1.0"
blobrepo = { version = "0.1.0", path = "../../blobrepo" }
blobrepo_factory = { version = "0.1.0", path = "../../blobrepo/factory" }
blobrepo_hg = { version = "0.1.0", path = "../../blobrepo/blobrepo_hg" }
bookmarks = { version = "0.1.0", path = "../../bookmarks" }
borrowed = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
@ -21,6 +20,7 @@ maplit = "1.0"
mercurial_types = { version = "0.1.0", path = "../../mercurial/types" }
mononoke_types = { version = "0.1.0", path = "../../mononoke_types" }
sorted_vector_map = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
test_repo_factory = { version = "0.1.0", path = "../../repo_factory/test_repo_factory" }
[dev-dependencies]
async_unit = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }

View File

@ -25,6 +25,7 @@ use mononoke_types::{
use sorted_vector_map::SortedVectorMap;
use std::collections::BTreeMap;
use std::str::FromStr;
use test_repo_factory::TestRepoFactory;
pub async fn store_files(
ctx: &CoreContext,
@ -306,7 +307,7 @@ pub mod linear {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -320,7 +321,7 @@ pub mod branch_even {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -428,7 +429,7 @@ pub mod branch_uneven {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -596,7 +597,7 @@ pub mod branch_wide {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -704,7 +705,7 @@ pub mod merge_even {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -827,7 +828,7 @@ pub mod many_files_dirs {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -924,7 +925,7 @@ pub mod merge_uneven {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -1111,7 +1112,7 @@ pub mod unshared_merge_even {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -1302,7 +1303,7 @@ pub mod unshared_merge_uneven {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}
@ -1636,7 +1637,7 @@ pub mod many_diamonds {
}
pub async fn getrepo_with_id(fb: FacebookInit, id: RepositoryId) -> BlobRepo {
let blobrepo = blobrepo_factory::new_memblob_empty_with_id(None, id).unwrap();
let blobrepo = TestRepoFactory::new().unwrap().with_id(id).build().unwrap();
initrepo(fb, &blobrepo).await;
blobrepo
}