Avoid async fs call before checking if operation is applicable

This way, the executor isn't influenced by operations that aren't applicable.
This commit is contained in:
Max Brunsfeld 2023-04-05 18:11:33 -07:00
parent 1064b14779
commit bf3b8adf35

View file

@ -735,11 +735,13 @@ async fn apply_client_operation(
is_dir, is_dir,
content, content,
} => { } => {
client if !client
.fs .fs
.metadata(&path.parent().unwrap()) .directories()
.await? .contains(&path.parent().unwrap().to_owned())
.ok_or(TestError::Inapplicable)?; {
return Err(TestError::Inapplicable);
}
if is_dir { if is_dir {
log::info!("{}: creating dir at {:?}", client.username, path); log::info!("{}: creating dir at {:?}", client.username, path);
@ -761,13 +763,8 @@ async fn apply_client_operation(
repo_path, repo_path,
contents, contents,
} => { } => {
if !client if !client.fs.directories().contains(&repo_path) {
.fs return Err(TestError::Inapplicable);
.metadata(&repo_path)
.await?
.map_or(false, |m| m.is_dir)
{
Err(TestError::Inapplicable)?;
} }
log::info!( log::info!(