Skip to content

Commit

Permalink
Corrects exercise_set_umask_0022 unit test
Browse files Browse the repository at this point in the history
The ctl_gateway_generate_and_read_tls_files unit test was broken by the
exercise_set_umask_0022 unit test because it sleeps for 2 minutes during
which time the exercise_set_umask_0022 unit test ran and changed the
umask state prior to ctl_gateway_generate_and_read_tls_files resuming.
This makes the exercise_set_umask_0022 unit test put the umask back into
the state it was when it started.

Signed-off-by: Jason Heath <[email protected]>
  • Loading branch information
jasonheath committed Sep 24, 2024
1 parent 99f0092 commit a4e7477
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/core/src/util/posix_perm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,11 @@ mod tests {

// There's no "reasonable" way I've found to get the current umask so I'm just exploiting
// what I know about the umask system call to set it so that we have a known umask value.
let _ = umask(0o0777).unwrap();

let unknown_umask = umask(0o0777).unwrap();
let known_umask = set_umask_0022().unwrap();
let umask_0022 = umask(0o0777).unwrap();
let _ = umask(unknown_umask).unwrap();

assert_eq!(known_umask, 0o0777);
assert_eq!(umask_0022, 0o0022);
Expand Down

0 comments on commit a4e7477

Please sign in to comment.