Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/fuzzy_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,13 @@ mod tests {
// Validate hour field
let hour: u32 = parts[1].parse().expect("Hour should be a number");
assert!(hour < 24, "Hour should be 0-23");

// Daily schedule must not restrict day-of-month, month, or day-of-week.
// A regression that adds e.g. a day-of-week constraint would silently
// turn a daily schedule into a weekly one.
assert_eq!(parts[2], "*", "Day-of-month should be * for a daily schedule");
assert_eq!(parts[3], "*", "Month should be * for a daily schedule");
assert_eq!(parts[4], "*", "Day-of-week should be * for a daily schedule");
}

#[test]
Expand Down Expand Up @@ -991,6 +998,10 @@ mod tests {
let yaml = generate_schedule_yaml("daily", "test/agent", &[]).unwrap();
assert!(yaml.contains("schedules:"));
assert!(yaml.contains("cron:"));
// `always: true` is load-bearing — without it ADO only fires the schedule
// when the target branch has changed since the last run, turning a
// "run unconditionally on schedule" pipeline into one that silently skips.
assert!(yaml.contains("always: true"), "schedule YAML must include always: true");
// No branches filter by default
assert!(!yaml.contains("branches:"));
}
Expand All @@ -1001,6 +1012,7 @@ mod tests {
let yaml = generate_schedule_yaml("daily", "test/agent", &branches).unwrap();
assert!(yaml.contains("schedules:"));
assert!(yaml.contains("cron:"));
assert!(yaml.contains("always: true"), "schedule YAML must include always: true");
assert!(yaml.contains("branches:"));
assert!(yaml.contains("include:"));
assert!(yaml.contains("- main"));
Expand Down
11 changes: 0 additions & 11 deletions src/runtimes/dotnet/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,6 @@ mod tests {
assert!(ext.validate(&ctx_from(&fm)).is_err());
}

#[test]
fn test_validate_global_json_sentinel_skips_injection_check() {
let (fm, _) = parse_markdown(
"---\nname: test\ndescription: test\nruntimes:\n dotnet:\n version: 'global.json'\n---\n",
)
.unwrap();
let dotnet = fm.runtimes.as_ref().unwrap().dotnet.as_ref().unwrap();
let ext = DotnetExtension::new(dotnet.clone());
assert!(ext.validate(&ctx_from(&fm)).is_ok());
}

#[test]
fn test_validate_global_json_conflict_bails() {
let tmp = tempfile::tempdir().unwrap();
Expand Down