Skip to content

Commit

Permalink
Update test expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 authored and squell committed Feb 4, 2025
1 parent 0b2f4b4 commit 9890075
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
16 changes: 8 additions & 8 deletions test-framework/sudo-compliance-tests/src/sudo/sudoers/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn file_does_not_exist() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
"sudo: unable to open /etc/sudoers2: No such file or directory"
} else {
"sudo-rs: cannot open sudoers file '/etc/sudoers2'"
"cannot open sudoers file '/etc/sudoers2'"
};
assert_contains!(output.stderr(), diagnostic);
Ok(())
Expand Down Expand Up @@ -128,7 +128,7 @@ fn include_loop_error_messages() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
"/etc/sudoers2: too many levels of includes"
} else {
"sudo-rs: include file limit reached opening '/etc/sudoers2'"
"include file limit reached opening '/etc/sudoers2'"
};
assert_contains!(output.stderr(), diagnostic);

Expand All @@ -147,7 +147,7 @@ fn include_loop_not_fatal() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
"/etc/sudoers2: too many levels of includes"
} else {
"sudo-rs: include file limit reached opening '/etc/sudoers2'"
"include file limit reached opening '/etc/sudoers2'"
};
assert_contains!(output.stderr(), diagnostic);

Expand All @@ -170,7 +170,7 @@ fn permissions_check() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
"sudo: /etc/sudoers2 is world writable"
} else {
"sudo-rs: /etc/sudoers2 cannot be world-writable"
"/etc/sudoers2 cannot be world-writable"
};
assert_contains!(output.stderr(), diagnostic);

Expand All @@ -189,7 +189,7 @@ fn permissions_check_not_fatal() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
format!("sudo: {ETC_DIR}/sudoers2 is world writable")
} else {
format!("sudo-rs: {ETC_DIR}/sudoers2 cannot be world-writable")
format!("{ETC_DIR}/sudoers2 cannot be world-writable")
};
assert_contains!(output.stderr(), diagnostic);

Expand All @@ -213,7 +213,7 @@ fn ownership_check() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
"sudo: /etc/sudoers2 is owned by uid 1000, should be 0"
} else {
"sudo-rs: /etc/sudoers2 must be owned by root"
"/etc/sudoers2 must be owned by root"
};
assert_contains!(output.stderr(), diagnostic);

Expand All @@ -233,7 +233,7 @@ fn ownership_check_not_fatal() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
"sudo: /etc/sudoers2 is owned by uid 1000, should be 0"
} else {
"sudo-rs: /etc/sudoers2 must be owned by root"
"/etc/sudoers2 must be owned by root"
};
assert_contains!(output.stderr(), diagnostic);

Expand Down Expand Up @@ -284,7 +284,7 @@ fn relative_path_grandparent_directory() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
format!("sudo: unable to open {path}: No such file or directory")
} else {
format!("sudo-rs: cannot open sudoers file '{path}'")
format!("cannot open sudoers file '{path}'")
};
assert_contains!(output.stderr(), diagnostic);
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ fn directory_does_not_exist_is_not_fatal() -> Result<()> {
if sudo_test::is_original_sudo() {
assert!(stderr.is_empty());
} else {
assert_contains!(
stderr,
"sudo-rs: cannot open sudoers file /etc/does-not-exist"
);
assert_contains!(stderr, "cannot open sudoers file /etc/does-not-exist");
}

Ok(())
Expand Down Expand Up @@ -192,7 +189,7 @@ fn include_loop() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
format!("{ETC_DIR}/sudoers.d/a: too many levels of includes")
} else {
format!("sudo-rs: include file limit reached opening '{ETC_DIR}/sudoers.d/a'")
format!("include file limit reached opening '{ETC_DIR}/sudoers.d/a'")
};
assert_contains!(output.stderr(), diagnostic);

Expand Down Expand Up @@ -227,7 +224,7 @@ fn statements_prior_to_include_loop_are_evaluated() -> Result<()> {
let diagnostic = if sudo_test::is_original_sudo() {
format!("{ETC_DIR}/sudoers.d/a: too many levels of includes")
} else {
format!("sudo-rs: include file limit reached opening '{ETC_DIR}/sudoers.d/a'")
format!("include file limit reached opening '{ETC_DIR}/sudoers.d/a'")
};

assert_contains!(output.stderr(), diagnostic);
Expand Down Expand Up @@ -350,7 +347,7 @@ fn ignores_directory_with_bad_perms() -> Result<()> {
]
} else {
[
format!("sudo-rs: {ETC_DIR}/sudoers2.d cannot be world-writable"),
format!("{ETC_DIR}/sudoers2.d cannot be world-writable"),
"I'm sorry root. I'm afraid I can't do that".to_owned(),
]
};
Expand Down Expand Up @@ -380,7 +377,7 @@ fn ignores_directory_with_bad_ownership() -> Result<()> {
]
} else {
[
format!("sudo-rs: {ETC_DIR}/sudoers2.d must be owned by root"),
format!("{ETC_DIR}/sudoers2.d must be owned by root"),
"I'm sorry root. I'm afraid I can't do that".to_owned(),
]
};
Expand Down

0 comments on commit 9890075

Please sign in to comment.