Skip to content

Commit

Permalink
removed watches
Browse files Browse the repository at this point in the history
  • Loading branch information
iesahin committed Dec 27, 2024
1 parent ae4220e commit 6bd3129
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 113 deletions.
5 changes: 0 additions & 5 deletions lib/tests/test_storage_new_gcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ fn test_storage_new_gcs() -> Result<()> {
&format!("ls --recursive s3://{bucket_name}"),
&format!("| rg {storage_prefix} | rg 0.bin"),
);
watch!(file_list_after);

// The file should be in:
// - storage_dir/REPO_ID/b3/ABCD...123/0.bin
Expand All @@ -208,8 +207,6 @@ fn test_storage_new_gcs() -> Result<()> {

let fetch_result = x(&["file", "bring", "--no-recheck", "--from", "gcs-storage"])?;

watch!(fetch_result);

let n_local_files_after_fetch = jwalk::WalkDir::new(&cache_dir)
.into_iter()
.filter(|f| {
Expand All @@ -226,7 +223,6 @@ fn test_storage_new_gcs() -> Result<()> {
fs::remove_file(the_file)?;

let pull_result = x(&["file", "bring", "--from", "gcs-storage"])?;
watch!(pull_result);

let n_local_files_after_pull = jwalk::WalkDir::new(&cache_dir)
.into_iter()
Expand All @@ -248,7 +244,6 @@ fn test_storage_new_gcs() -> Result<()> {
env::remove_var("GCS_SECRET_ACCESS_KEY");

let pull_result_2 = x(&["file", "bring", "--from", "gcs-storage"])?;
watch!(pull_result_2);

clean_up(&xvc_root)
}
11 changes: 0 additions & 11 deletions lib/tests/test_storage_new_generic_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,13 @@ fn test_storage_new_generic_fs() -> Result<()> {

let storage_dir = PathBuf::from(temp_directory).join(storage_dir_name);

watch!(storage_dir);
watch!(out);

assert!(storage_dir.exists());

assert!(storage_dir.join(XVC_STORAGE_GUID_FILENAME).exists());

let the_file = "file-0000.bin";

let file_track_result = x(&["file", "track", the_file])?;
watch!(file_track_result);

let n_storage_files_before = jwalk::WalkDir::new(&storage_dir)
.into_iter()
Expand All @@ -80,10 +76,7 @@ fn test_storage_new_generic_fs() -> Result<()> {
})
.count();

watch!(n_storage_files_before);

let push_result = x(&["file", "send", "--to", "generic-storage", the_file])?;
watch!(push_result);

// The file should be in:
// - storage_dir/REPO_ID/b3/ABCD...123/0.bin
Expand All @@ -96,7 +89,6 @@ fn test_storage_new_generic_fs() -> Result<()> {
.unwrap_or_else(|_| false)
})
.count();
watch!(n_storage_files_after);

assert!(
n_storage_files_before + 1 == n_storage_files_after,
Expand All @@ -112,8 +104,6 @@ fn test_storage_new_generic_fs() -> Result<()> {

let fetch_result = x(&["file", "bring", "--no-recheck", "--from", "generic-storage"])?;

watch!(fetch_result);

let n_local_files_after_fetch = jwalk::WalkDir::new(&cache_dir)
.into_iter()
.filter(|f| {
Expand All @@ -130,7 +120,6 @@ fn test_storage_new_generic_fs() -> Result<()> {
fs::remove_file(the_file)?;

let pull_result = x(&["file", "bring", "--from", "generic-storage"])?;
watch!(pull_result);

let n_local_files_after_pull = jwalk::WalkDir::new(&cache_dir)
.into_iter()
Expand Down
10 changes: 0 additions & 10 deletions lib/tests/test_storage_new_generic_rsync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ fn create_directory_hierarchy() -> Result<XvcRoot> {
}

fn sh(cmd: String) -> String {
watch!(cmd);
Exec::shell(cmd).capture().unwrap().stdout_str()
}

Expand Down Expand Up @@ -71,19 +70,15 @@ fn test_storage_new_generic_rsync() -> Result<()> {
"4",
])?;

watch!(out);

let storage_list = sh(format!(
"ssh {url} 'ls -l {storage_dir_name}{XVC_STORAGE_GUID_FILENAME}'"
));

watch!(storage_list);
assert!(!storage_list.is_empty());

let the_file = "file-0000.bin";

let file_track_result = x(&["file", "track", the_file])?;
watch!(file_track_result);

let n_storage_files_before = jwalk::WalkDir::new(local_test_dir)
.into_iter()
Expand All @@ -94,10 +89,8 @@ fn test_storage_new_generic_rsync() -> Result<()> {
})
.count();
let push_result = x(&["file", "send", "--to", "generic-storage", the_file])?;
watch!(push_result);

let file_list = sh(format!("ssh {url} 'ls -1R {storage_dir_name} | grep bin'"));
watch!(file_list);

// The file should be in:
// - storage_dir/REPO_ID/b3/ABCD...123/0.bin
Expand All @@ -118,8 +111,6 @@ fn test_storage_new_generic_rsync() -> Result<()> {

let fetch_result = x(&["file", "bring", "--no-recheck", "--from", "generic-storage"])?;

watch!(fetch_result);

let n_local_files_after_fetch = jwalk::WalkDir::new(&cache_dir)
.into_iter()
.filter(|f| {
Expand All @@ -136,7 +127,6 @@ fn test_storage_new_generic_rsync() -> Result<()> {
fs::remove_file(the_file)?;

let pull_result = x(&["file", "bring", "--from", "generic-storage"])?;
watch!(pull_result);

let n_local_files_after_pull = jwalk::WalkDir::new(&cache_dir)
.into_iter()
Expand Down
14 changes: 0 additions & 14 deletions lib/tests/test_storage_new_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use xvc_test_helper::generate_filled_file;

fn create_directory_hierarchy() -> Result<XvcRoot> {
let temp_dir: XvcRoot = run_in_temp_xvc_dir()?;
watch!(temp_dir);
// for checking the content hash
generate_filled_file(&temp_dir.join(&PathBuf::from("file-0000.bin")), 10000, 100);
// create_directory_tree(&temp_dir, 10, 10)?;
Expand Down Expand Up @@ -44,12 +43,10 @@ fn test_storage_new_local() -> Result<()> {
])?;

assert!(storage_dir.join(XVC_STORAGE_GUID_FILENAME).exists());
watch!(out);

let the_file = "file-0000.bin";

let file_track_result = x(&["file", "track", the_file])?;
watch!(file_track_result);

let n_storage_files_before = jwalk::WalkDir::new(&storage_dir)
.into_iter()
Expand All @@ -61,7 +58,6 @@ fn test_storage_new_local() -> Result<()> {
.count();

let push_result = x(&["file", "send", "--to", "local-storage", the_file])?;
watch!(push_result);

// The file should be in:
// - storage_dir/REPO_ID/b3/ABCD...123/0.bin
Expand All @@ -75,7 +71,6 @@ fn test_storage_new_local() -> Result<()> {
})
.count();

watch!(n_storage_files_after);
assert!(
n_storage_files_before + 1 == n_storage_files_after,
"{} - {}",
Expand All @@ -93,8 +88,6 @@ fn test_storage_new_local() -> Result<()> {

let fetch_result = x(&["file", "bring", "--no-recheck", "--from", "local-storage"])?;

watch!(fetch_result);

let n_local_files_after_fetch = jwalk::WalkDir::new(&cache_dir)
.into_iter()
.filter(|f| {
Expand All @@ -114,7 +107,6 @@ fn test_storage_new_local() -> Result<()> {
fs::remove_file(the_file)?;

let bring_result = x(&["file", "bring", "--from", "local-storage"])?;
watch!(bring_result);

let n_local_files_after_pull = jwalk::WalkDir::new(&cache_dir)
.into_iter()
Expand All @@ -124,23 +116,17 @@ fn test_storage_new_local() -> Result<()> {
.unwrap_or_else(|_| false)
})
.count();
watch!(n_local_files_after_pull);
assert!(n_storage_files_after == n_local_files_after_pull);
watch!(the_file);
let tree_result = sh("tree")?;
watch!(String::from_utf8(tree_result.stdout));
assert!(PathBuf::from(the_file).exists());

// When we reinit with the same storage path, it shouldn't update the GUID.
// See https://github.com/iesahin/xvc/issues/123
let current_guid = fs::read_to_string(storage_dir.join(XVC_STORAGE_GUID_FILENAME))?;
watch!(current_guid);
// We'll use a separate process to run the following tests.
// Entity counter cannot be loaded to the same process twice.
let another_xvc_root = assert_fs::TempDir::new()?;
watch!(another_xvc_root);
let mut xvc = assert_cmd::cmd::Command::cargo_bin("xvc")?;
watch!(xvc);
xvc.current_dir(&another_xvc_root);
xvc.arg("init").assert();
xvc.args([
Expand Down
12 changes: 0 additions & 12 deletions lib/tests/test_storage_new_minio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ fn mc_config(alias: &str, endpoint: &str, access_key: &str, secret_key: &str) ->
}

fn sh(cmd: String) -> String {
watch!(cmd);
Exec::shell(cmd).capture().unwrap().stdout_str()
}

Expand Down Expand Up @@ -95,16 +94,12 @@ fn test_storage_new_minio() -> Result<()> {
region,
])?;

watch!(out);

let mc_bucket_list = mc("ls", &format!("| rg {bucket_name}"));
watch!(mc_bucket_list);
assert!(!mc_bucket_list.is_empty());

let the_file = "file-0000.bin";

let file_track_result = x(&["file", "track", the_file])?;
watch!(file_track_result);

let n_storage_files_before = jwalk::WalkDir::new(local_test_dir)
.into_iter()
Expand All @@ -115,10 +110,8 @@ fn test_storage_new_minio() -> Result<()> {
})
.count();
let push_result = x(&["file", "send", "--to", "minio-storage", the_file])?;
watch!(push_result);

let file_list = mc("ls -r ", &format!("| rg {bucket_name}/{storage_prefix}"));
watch!(file_list);

// The file should be in:
// - storage_dir/REPO_ID/b3/ABCD...123/0.bin
Expand All @@ -141,12 +134,9 @@ fn test_storage_new_minio() -> Result<()> {

let fetch_result = x(&["file", "bring", "--no-recheck", "--from", "minio-storage"])?;

watch!(fetch_result);

let n_local_files_after_fetch = jwalk::WalkDir::new(&cache_dir)
.into_iter()
.filter(|f| {
watch!(f);
f.as_ref()
.map(|f| f.file_type().is_file())
.unwrap_or_else(|_| false)
Expand All @@ -166,7 +156,6 @@ fn test_storage_new_minio() -> Result<()> {
fs::remove_file(the_file)?;

let pull_result = x(&["file", "bring", "--from", "minio-storage"])?;
watch!(pull_result);

let n_local_files_after_pull = jwalk::WalkDir::new(&cache_dir)
.into_iter()
Expand All @@ -193,7 +182,6 @@ fn test_storage_new_minio() -> Result<()> {
env::remove_var("MINIO_SECRET_ACCESS_KEY");

let pull_result_2 = x(&["file", "bring", "--from", "minio-storage"])?;
watch!(pull_result_2);

clean_up(&xvc_root)
}
11 changes: 0 additions & 11 deletions lib/tests/test_storage_new_r2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ fn create_directory_hierarchy() -> Result<XvcRoot> {
}

fn sh(cmd: String) -> String {
watch!(cmd);
Exec::shell(cmd).capture().unwrap().stdout_str()
}

Expand All @@ -148,7 +147,6 @@ fn test_storage_new_r2() -> Result<()> {
let account_id = account_id.trim();

let config_file_name = write_s3cmd_config(account_id, access_key, secret_key)?;
watch!(config_file_name);

let s3cmd = |cmd: &str, append: &str| -> String {
let sh_cmd = format!("s3cmd --no-check-md5 --config {config_file_name} {cmd} {append}");
Expand All @@ -173,12 +171,10 @@ fn test_storage_new_r2() -> Result<()> {
account_id,
])?;

watch!(out);
let s3_bucket_list = s3cmd(
&format!("ls --recursive 's3://{bucket_name}'"),
&format!("| rg {storage_prefix} | rg {XVC_STORAGE_GUID_FILENAME}"),
);
watch!(s3_bucket_list);
assert!(!s3_bucket_list.is_empty());

let the_file = "file-0000.bin";
Expand All @@ -191,16 +187,13 @@ fn test_storage_new_r2() -> Result<()> {
&format!("ls --recursive s3://{bucket_name}"),
&format!("| rg {storage_prefix} | rg 0.bin"),
);
watch!(file_list_before);
let n_storage_files_before = file_list_before.lines().count();
let push_result = x(&["file", "send", "--to", "r2-storage", the_file])?;
watch!(push_result);

let file_list_after = s3cmd(
&format!("ls --recursive s3://{bucket_name}"),
&format!("| rg {storage_prefix} | rg 0.bin"),
);
watch!(file_list_after);

// The file should be in:
// - storage_dir/REPO_ID/b3/ABCD...123/0.bin
Expand All @@ -219,8 +212,6 @@ fn test_storage_new_r2() -> Result<()> {

let fetch_result = x(&["file", "bring", "--no-recheck", "--from", "r2-storage"])?;

watch!(fetch_result);

let n_local_files_after_fetch = jwalk::WalkDir::new(&cache_dir)
.into_iter()
.filter(|f| {
Expand All @@ -237,7 +228,6 @@ fn test_storage_new_r2() -> Result<()> {
fs::remove_file(the_file)?;

let pull_result = x(&["file", "bring", "--from", "r2-storage"])?;
watch!(pull_result);

let n_local_files_after_pull = jwalk::WalkDir::new(&cache_dir)
.into_iter()
Expand All @@ -259,7 +249,6 @@ fn test_storage_new_r2() -> Result<()> {
env::remove_var("R2_SECRET_ACCESS_KEY");

let pull_result_2 = x(&["file", "bring", "--from", "r2-storage"])?;
watch!(pull_result_2);

clean_up(&xvc_root)
}
Loading

0 comments on commit 6bd3129

Please sign in to comment.