Unverified Commit 0202c583 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

test: align aborted task GC pin check with current predicate

Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
parent a82d9ffc
...@@ -1116,26 +1116,25 @@ mod tests { ...@@ -1116,26 +1116,25 @@ mod tests {
fn in_progress_task_is_pinned_but_not_collectible() { fn in_progress_task_is_pinned_but_not_collectible() {
let mut storage = TaskStorage::new(); let mut storage = TaskStorage::new();
storage.flags.set_meta_restored(true); storage.flags.set_meta_restored(true);
assert!(storage.gc_maybe_collectible()); assert!(storage.gc_collectible());
assert!(!storage.gc_is_root()); assert!(!storage.gc_is_root());
// An execution pins the task: it cannot be collected, and the parent-less task is // An execution pins the task: it cannot be collected, and the parent-less task is
// classified as a root whose debug validation accepts the in-progress state as the pin. // classified as a root while the in-progress state is the transient pin.
storage.set_in_progress(InProgressState::new_scheduled( storage.set_in_progress(InProgressState::new_scheduled(
TaskExecutionReason::Root, TaskExecutionReason::Root,
EventDescription::new(|| || "test task".to_string()), EventDescription::new(|| || "test task".to_string()),
)); ));
assert!(!storage.gc_maybe_collectible()); assert!(!storage.gc_collectible());
assert!(storage.gc_is_root()); assert!(storage.gc_is_root());
storage.gc_debug_assert_root_held_by_transient_pin();
// Once the execution finishes, the unreferenced task becomes collectible again. // Once the execution finishes, the unreferenced task becomes collectible again.
storage.take_in_progress(); storage.take_in_progress();
assert!(storage.gc_maybe_collectible()); assert!(storage.gc_collectible());
assert!(!storage.gc_is_root()); assert!(!storage.gc_is_root());
storage.set_parent_count(1); storage.set_parent_count(1);
assert!(!storage.gc_maybe_collectible()); assert!(!storage.gc_collectible());
} }
#[test] #[test]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment