test_repo_factory: use test factory for repo_client and repo_import tests

Summary: Use the test factory for existing repo_client and repo_import tests.

Reviewed By: StanislavGlebik

Differential Revision: D27169425

fbshipit-source-id: 2d0c34f129447232cec8faee42056d83613de179
This commit is contained in:
Mark Juggurnauth-Thomas 2021-03-25 07:32:21 -07:00 committed by Facebook GitHub Bot
parent ee159ebecc
commit fb9f966acf
11 changed files with 28 additions and 32 deletions

View File

@ -59,10 +59,10 @@ unbundle = { version = "0.1.0", path = "unbundle" }
warm_bookmarks_cache = { version = "0.1.0", path = "../bookmarks/warm_bookmarks_cache" }
[dev-dependencies]
blobrepo_factory = { version = "0.1.0", path = "../blobrepo/factory" }
fbinit-tokio-02 = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
fixtures = { version = "0.1.0", path = "../tests/fixtures" }
mononoke_api = { version = "0.1.0", path = "../mononoke_api" }
mutable_counters = { version = "0.1.0", path = "../mutable_counters" }
sql_construct = { version = "0.1.0", path = "../common/sql_construct" }
test_repo_factory = { version = "0.1.0", path = "../repo_factory/test_repo_factory" }
tests_utils = { version = "0.1.0", path = "../tests/utils" }

View File

@ -40,10 +40,10 @@ thiserror = "1.0"
tunables = { version = "0.1.0", path = "../../tunables" }
[dev-dependencies]
blobrepo_factory = { version = "0.1.0", path = "../../blobrepo/factory" }
fbinit = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
fbinit-tokio-02 = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
maplit = "1.0"
mononoke_types-mocks = { version = "0.1.0", path = "../../mononoke_types/mocks" }
skiplist = { version = "0.1.0", path = "../../reachabilityindex/skiplist" }
test_repo_factory = { version = "0.1.0", path = "../../repo_factory/test_repo_factory" }
tests_utils = { version = "0.1.0", path = "../../tests/utils" }

View File

@ -604,7 +604,7 @@ mod test {
#[fbinit::test]
async fn test_compute_partial_getbundle(fb: FacebookInit) -> Result<(), Error> {
let ctx = CoreContext::test_mock(fb);
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let commit_map = create_from_dag(
&ctx,
@ -806,7 +806,7 @@ mod test {
#[fbinit::test]
async fn test_low_gen_num_two_heads(fb: FacebookInit) -> Result<(), Error> {
let ctx = CoreContext::test_mock(fb);
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let commit_map = create_from_dag(
&ctx,
@ -935,7 +935,7 @@ mod test {
async fn create_repo(
ctx: &CoreContext,
) -> Result<(BlobRepo, BTreeMap<String, ChangesetId>), Error> {
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let commit_map = create_from_dag(
ctx,
@ -953,7 +953,7 @@ mod test {
async fn create_mergy_repo(
ctx: &CoreContext,
) -> Result<(BlobRepo, BTreeMap<String, ChangesetId>), Error> {
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let commit_map = create_from_dag(
ctx,

View File

@ -26,11 +26,11 @@ tunables = { version = "0.1.0", path = "../../tunables" }
[dev-dependencies]
assert_matches = "1.5"
blobrepo_factory = { version = "0.1.0", path = "../../blobrepo/factory" }
blobrepo_override = { version = "0.1.0", path = "../../blobrepo/override" }
borrowed = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
fbinit = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
fbinit-tokio-02 = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
manifest = { version = "0.1.0", path = "../../manifest" }
mononoke_types = { version = "0.1.0", path = "../../mononoke_types" }
test_repo_factory = { version = "0.1.0", path = "../../repo_factory/test_repo_factory" }
tests_utils = { version = "0.1.0", path = "../../tests/utils" }

View File

@ -408,7 +408,7 @@ mod test {
#[fbinit::test]
async fn test_prepare_blob(fb: FacebookInit) -> Result<(), Error> {
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let blob = roundtrip_blob(fb, &repo, "foo", Some(3)).await?;
assert_matches!(blob, RemotefilelogBlobKind::Inline(3));
Ok(())
@ -416,12 +416,11 @@ mod test {
#[fbinit::test]
async fn test_prepare_blob_chunked(fb: FacebookInit) -> Result<(), Error> {
let repo = blobrepo_factory::new_memblob_empty(None)?.dangerous_override(
|mut config: FilestoreConfig| {
config.chunk_size = Some(1);
config
},
);
let repo: BlobRepo = test_repo_factory::build_empty()?;
let repo = repo.dangerous_override(|mut config: FilestoreConfig| {
config.chunk_size = Some(1);
config
});
let blob = roundtrip_blob(fb, &repo, "foo", None).await?;
assert_matches!(blob, RemotefilelogBlobKind::Inline(3));
@ -430,7 +429,7 @@ mod test {
#[fbinit::test]
async fn test_prepare_blob_lfs(fb: FacebookInit) -> Result<(), Error> {
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let blob = roundtrip_blob(fb, &repo, "foo", Some(2)).await?;
assert_matches!(blob, RemotefilelogBlobKind::Lfs(3));
Ok(())

View File

@ -303,7 +303,7 @@ mod test {
async fn test_fetch_prefix_no_warm_bookmark_cache(fb: FacebookInit) -> Result<(), Error> {
let ctx = CoreContext::test_mock(fb);
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let cs_id = CreateCommitContext::new_root(&ctx, &repo)
.add_file("1", "1")

View File

@ -247,7 +247,7 @@ async fn get_changed_manifests_stream_test_base_path_impl(fb: FacebookInit) -> R
#[fbinit::test]
async fn test_lfs_rollout(fb: FacebookInit) -> Result<(), Error> {
let ctx = CoreContext::test_mock(fb);
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let commit = CreateCommitContext::new_root(&ctx, &repo)
.add_file("largefile", "11111_11111")
.commit()

View File

@ -61,10 +61,10 @@ tunables = { version = "0.1.0", path = "../../tunables" }
wirepack = { version = "0.1.0", path = "../wirepack" }
[dev-dependencies]
blobrepo_factory = { version = "0.1.0", path = "../../blobrepo/factory" }
fbinit = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
fbinit-tokio-02 = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
itertools = "0.8"
mercurial_types-mocks = { version = "0.1.0", path = "../../mercurial/types/mocks" }
quickcheck_async = "0.1.1"
quickcheck_macros = "0.8"
test_repo_factory = { version = "0.1.0", path = "../../repo_factory/test_repo_factory" }

View File

@ -315,7 +315,6 @@ mod tests {
use std::cmp::min;
use blobrepo_factory::new_memblob_empty;
use fbinit::FacebookInit;
use futures::stream::iter;
use itertools::{assert_equal, EitherOrBoth, Itertools};
@ -357,7 +356,7 @@ mod tests {
{
let result = convert_to_revlog_filelog(
ctx,
new_memblob_empty(None).unwrap(),
test_repo_factory::build_empty().unwrap(),
iter(inp.into_iter().map(Ok).collect::<Vec<_>>()),
)
.try_collect::<Vec<_>>()
@ -515,7 +514,7 @@ mod tests {
let result = convert_to_revlog_filelog(
ctx,
new_memblob_empty(None).unwrap(),
test_repo_factory::build_empty().unwrap(),
iter(inp.into_iter().map(Ok)),
)
.try_collect::<Vec<_>>()

View File

@ -42,7 +42,6 @@ topo_sort = { version = "0.1.0", path = "../common/topo_sort" }
[dev-dependencies]
ascii = "1.0"
blobrepo_factory = { version = "0.1.0", path = "../blobrepo/factory" }
blobrepo_override = { version = "0.1.0", path = "../blobrepo/override" }
cached_config = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
derived_data = { version = "0.1.0", path = "../derived_data" }
@ -50,6 +49,6 @@ fbinit-tokio-02 = { version = "0.1.0", git = "https://github.com/facebookexperim
git_types = { version = "0.1.0", path = "../git/git_types" }
mercurial_types-mocks = { version = "0.1.0", path = "../mercurial/types/mocks" }
mononoke_types-mocks = { version = "0.1.0", path = "../mononoke_types/mocks" }
sql = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "master" }
sql_construct = { version = "0.1.0", path = "../common/sql_construct" }
test_repo_factory = { version = "0.1.0", path = "../repo_factory/test_repo_factory" }
tests_utils = { version = "0.1.0", path = "../tests/utils" }

View File

@ -48,12 +48,12 @@ mod tests {
use mononoke_types_mocks::changesetid::{ONES_CSID as MON_CSID, TWOS_CSID};
use movers::{DefaultAction, Mover};
use mutable_counters::{MutableCounters, SqlMutableCounters};
use sql::rusqlite::Connection as SqliteConnection;
use sql_construct::SqlConstruct;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;
use synced_commit_mapping::SqlSyncedCommitMapping;
use test_repo_factory::TestRepoFactory;
use tests_utils::{
bookmark, drawdag::create_from_dag, list_working_copy_utf8, CreateCommitContext,
};
@ -68,11 +68,10 @@ mod tests {
}
fn create_repo(id: i32) -> Result<BlobRepo> {
let (mut repo, _) = blobrepo_factory::new_memblob_with_sqlite_connection_with_id(
SqliteConnection::open_in_memory()?,
RepositoryId::new(id),
)?;
repo = repo.dangerous_override(|mut derived_data_config: DerivedDataConfig| {
let repo: BlobRepo = TestRepoFactory::new()?
.with_id(RepositoryId::new(id))
.build()?;
let repo = repo.dangerous_override(|mut derived_data_config: DerivedDataConfig| {
derived_data_config
.enabled
.types
@ -115,7 +114,7 @@ mod tests {
#[fbinit::test]
async fn test_move_bookmark(fb: FacebookInit) -> Result<()> {
let ctx = CoreContext::test_mock(fb);
let blob_repo = blobrepo_factory::new_memblob_empty(None)?;
let blob_repo = test_repo_factory::build_empty()?;
let mut recovery_fields = create_mock_recovery_fields();
let call_sign = Some("FBS".to_string());
let checker_flags = CheckerFlags {
@ -177,7 +176,7 @@ mod tests {
#[fbinit::test]
async fn test_move_bookmark_with_existing_bookmark(fb: FacebookInit) -> Result<()> {
let ctx = CoreContext::test_mock(fb);
let blob_repo = blobrepo_factory::new_memblob_empty(None)?;
let blob_repo = test_repo_factory::build_empty()?;
let mut recovery_fields = create_mock_recovery_fields();
let checker_flags = CheckerFlags {
phab_check_disabled: true,
@ -254,7 +253,7 @@ mod tests {
#[fbinit::test]
async fn test_hg_sync_check(fb: FacebookInit) -> Result<()> {
let ctx = CoreContext::test_mock(fb);
let repo = blobrepo_factory::new_memblob_empty(None)?;
let repo: BlobRepo = test_repo_factory::build_empty()?;
let checker_flags = CheckerFlags {
phab_check_disabled: true,
x_repo_check_disabled: true,