Adding additional checks for tasks and interval generation

This commit is contained in:
Kinesin Data Technologies Incorporated
2022-09-29 13:35:42 -03:00
parent cea5dfc8d4
commit 4ba2a3aa26
2 changed files with 18 additions and 3 deletions
+9 -1
View File
@@ -68,7 +68,7 @@ impl TaskDefinition {
requires: self.requires.clone(),
schedule: schedule,
valid_over: IntervalSet::from(vec![Interval::new(start, actual_end)]),
valid_over: IntervalSet::from(Interval::new(start, actual_end)),
timezone: self.timezone,
}
}
@@ -293,5 +293,13 @@ mod tests {
panic!("{:?}", e);
}
};
// Ensure that the intervals generated over the valid period
// exactly cover the valid period
let mut theoretical = ResourceInterval::new();
theoretical.insert(&"resource_a".to_owned(), &task.valid_over);
theoretical.insert(&"resource_b".to_owned(), &task.valid_over);
let generated = IntervalSet::from(task.generate_intervals(&theoretical).unwrap());
assert_eq!(task.valid_over, generated);
}
}