Simplify inject_index_part test function (#6207)

Instead of manually constructing the directory's path, we can just use
the `parent()` function.

This is a drive-by improvement from #6206
This commit is contained in:
Arpad Müller
2023-12-21 12:52:38 +01:00
committed by GitHub
parent baa1323b4a
commit 48890d206e

View File

@@ -2192,15 +2192,6 @@ mod tests {
let index_part_bytes = serde_json::to_vec(&example_index_part).unwrap();
let timeline_path = test_state.harness.timeline_path(&TIMELINE_ID);
let remote_timeline_dir = test_state.harness.remote_fs_dir.join(
timeline_path
.strip_prefix(&test_state.harness.conf.workdir)
.unwrap(),
);
std::fs::create_dir_all(remote_timeline_dir).expect("creating test dir should work");
let index_path = test_state.harness.remote_fs_dir.join(
remote_index_path(
&test_state.harness.tenant_shard_id,
@@ -2209,6 +2200,10 @@ mod tests {
)
.get_path(),
);
std::fs::create_dir_all(index_path.parent().unwrap())
.expect("creating test dir should work");
eprintln!("Writing {index_path}");
std::fs::write(&index_path, index_part_bytes).unwrap();
example_index_part