MCPcopy Create free account
hub / github.com/bootc-dev/bootc / test_varlog

Function test_varlog

crates/lib/src/lints.rs:1058–1092  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1056
1057 #[test]
1058 fn test_varlog() -> Result<()> {
1059 let root = &fixture()?;
1060 let config = &LintExecutionConfig::default();
1061 check_varlog(root, config).unwrap().unwrap();
1062 root.create_dir_all("var/log")?;
1063 check_varlog(root, config).unwrap().unwrap();
1064 root.symlink_contents("../../usr/share/doc/systemd/README.logs", "var/log/README")?;
1065 check_varlog(root, config).unwrap().unwrap();
1066
1067 root.atomic_write("var/log/somefile.log", "log contents")?;
1068 let Err(e) = check_varlog(root, config).unwrap() else {
1069 unreachable!()
1070 };
1071 similar_asserts::assert_eq!(
1072 e.to_string(),
1073 "Found non-empty logfiles:\n /var/log/somefile.log\n"
1074 );
1075 root.create_dir_all("var/log/someproject")?;
1076 root.atomic_write("var/log/someproject/audit.log", "audit log")?;
1077 root.atomic_write("var/log/someproject/info.log", "info")?;
1078 let Err(e) = check_varlog(root, config).unwrap() else {
1079 unreachable!()
1080 };
1081 similar_asserts::assert_eq!(
1082 e.to_string(),
1083 indoc! { r#"
1084 Found non-empty logfiles:
1085 /var/log/somefile.log
1086 /var/log/someproject/audit.log
1087 /var/log/someproject/info.log
1088 "# }
1089 );
1090
1091 Ok(())
1092 }
1093
1094 #[test]
1095 fn test_boot() -> Result<()> {

Callers

nothing calls this directly

Calls 2

check_varlogFunction · 0.85
fixtureFunction · 0.70

Tested by

no test coverage detected