Skip to content

Commit

Permalink
Add tests for ROBOCORP_HOME base
Browse files Browse the repository at this point in the history
CMK-20325
  • Loading branch information
jherbel committed Nov 25, 2024
1 parent 77017a3 commit 132f637
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ async fn test_scheduler() -> AnyhowResult<()> {
.join("plans")
.join(&config.plan_groups[0].plans[1].id),
);
assert_robocorp_home(
&config.rcc_config.robocorp_home_base,
#[cfg(windows)]
&current_user_name,
)
.await?;

Ok(())
}
Expand Down Expand Up @@ -660,3 +666,35 @@ fn assert_sequentiality(
dir_entries_second_plan.sort();
assert!(dir_entries_first_plan[0] < dir_entries_second_plan[0]);
}

async fn assert_robocorp_home(
robocorp_home_base: &Utf8Path,
#[cfg(windows)] headed_user_name: &str,
) -> AnyhowResult<()> {
assert!(robocorp_home_base.is_dir());
assert_eq!(
directory_entries(robocorp_home_base, 1),
[
"current_user",
#[cfg(windows)]
&format!("user_{headed_user_name}"),
]
);
#[cfg(windows)]
{
let permissions_robocorp_home_base = get_permissions(robocorp_home_base).await?;
assert_eq!(
permissions_robocorp_home_base
.lines()
.collect::<Vec<&str>>()
.len(),
3 // Administrator group + empty line + success message (suppressing the latter with /q does not seem to work)
);
assert!(
get_permissions(robocorp_home_base.join(format!("user_{headed_user_name}")))
.await?
.contains(&format!("{headed_user_name}:(OI)(CI)(F)",))
);
}
Ok(())
}

0 comments on commit 132f637

Please sign in to comment.