Skip to content

Commit f0a4793

Browse files
committed
Fix tests
1 parent e2ae730 commit f0a4793

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

crates/hyperqueue/src/server/autoalloc/process.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,7 @@ mod tests {
23822382
queue.add_allocation(Allocation::new(
23832383
id.to_string(),
23842384
worker_count,
2385-
PathBuf::new(),
2385+
PathBuf::new().into(),
23862386
));
23872387
}
23882388

@@ -2502,7 +2502,7 @@ mod tests {
25022502
*s += 1;
25032503
Ok(AllocationSubmissionResult::new(
25042504
Ok(id.to_string()),
2505-
Default::default(),
2505+
PathBuf::default().into(),
25062506
))
25072507
},
25082508
move |_, _| async move { Ok(Some(AllocationExternalStatus::Queued)) },
@@ -2519,7 +2519,7 @@ mod tests {
25192519

25202520
Ok(AllocationSubmissionResult::new(
25212521
Err(anyhow::anyhow!("failure")),
2522-
dir,
2522+
dir.into(),
25232523
))
25242524
},
25252525
move |_, _| async move { Ok(Some(AllocationExternalStatus::Queued)) },
@@ -2542,14 +2542,17 @@ mod tests {
25422542
if state.allocation_will_fail {
25432543
Ok(AllocationSubmissionResult::new(
25442544
AutoAllocResult::Err(anyhow!("Fail")),
2545-
dir,
2545+
dir.into(),
25462546
))
25472547
} else {
25482548
let spawned = &mut state.spawned_allocations;
25492549
let id = spawned.len();
25502550
spawned.insert(id.to_string());
25512551

2552-
Ok(AllocationSubmissionResult::new(Ok(id.to_string()), dir))
2552+
Ok(AllocationSubmissionResult::new(
2553+
Ok(id.to_string()),
2554+
dir.into(),
2555+
))
25532556
}
25542557
},
25552558
move |state, id| async move {

crates/hyperqueue/src/server/autoalloc/state.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl AutoAllocState {
121121
}
122122
#[cfg(test)]
123123
pub fn set_inactive_allocation_directories(&mut self, dirs: VecDeque<PathBuf>) {
124-
self.inactive_allocation_directories = dirs;
124+
self.inactive_allocation_directories = dirs.into_iter().map(|d| d.into()).collect();
125125
}
126126
}
127127

@@ -539,6 +539,7 @@ mod tests {
539539
Allocation, AutoAllocResult, QueueId, QueueInfo, QueueParameters,
540540
};
541541
use std::future::Future;
542+
use std::path::PathBuf;
542543
use std::pin::Pin;
543544
use std::time::Duration;
544545

@@ -596,8 +597,14 @@ mod tests {
596597
),
597598
None,
598599
);
599-
state.add_allocation(Allocation::new("1".to_string(), 1, Default::default()), id);
600-
state.add_allocation(Allocation::new("2".to_string(), 1, Default::default()), id);
600+
state.add_allocation(
601+
Allocation::new("1".to_string(), 1, PathBuf::default().into()),
602+
id,
603+
);
604+
state.add_allocation(
605+
Allocation::new("2".to_string(), 1, PathBuf::default().into()),
606+
id,
607+
);
601608
assert_eq!(state.allocation_to_queue.len(), 2);
602609
state.remove_queue(id);
603610
assert_eq!(state.allocation_to_queue.len(), 0);

0 commit comments

Comments
 (0)