Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

test(cua-spaces-cluster): pass the pool and session-resume tests on Windows (#6401)

injaneitya1be98cf1593
diff --git a/libs/cua/crates/cua-spaces-cluster/src/pool/mod.rs b/libs/cua/crates/cua-spaces-cluster/src/pool/mod.rs
index 88083c6a57..9417bf0032 100644
--- a/libs/cua/crates/cua-spaces-cluster/src/pool/mod.rs
+++ b/libs/cua/crates/cua-spaces-cluster/src/pool/mod.rs
@@ -1258,7 +1258,9 @@ mod tests {
fn machine(dir: &Path, name: &str, id: &str) -> PoolMachine {
let jobs = NodeJobs::open(
NodeConfig {
- dir: dir.join(id),
+ // `id` may be a direct host's `host:port`, and Windows
+ // refuses `:` in a directory name.
+ dir: dir.join(id.replace(':', "_")),
millicpus_total: 2000,
memory_total_mb: 4096,
jobs_max: 0,
diff --git a/libs/cua/crates/cua-spaces-cluster/tests/sessions.rs b/libs/cua/crates/cua-spaces-cluster/tests/sessions.rs
index ccd725e864..93d83cc5ab 100644
--- a/libs/cua/crates/cua-spaces-cluster/tests/sessions.rs
+++ b/libs/cua/crates/cua-spaces-cluster/tests/sessions.rs
@@ -163,10 +163,14 @@ async fn a_session_whose_host_is_killed_resumes_on_another_host() {
lab.hosts[first].kill();
let v = lab
.until("work", "resumed elsewhere", Duration::from_secs(60), |v| {
- v.epoch == 2 && v.state == sstate::RUNNING
+ v.epoch == 2 && v.state == sstate::RUNNING && !v.node.is_empty()
})
.await;
- let second = lab.starts().iter().find(|(_, e)| *e == 2).unwrap().0;
+ // A session reads running, then placed, before its driver reaches the host.
+ let second = wait_for("epoch 2 started", T, async || {
+ lab.starts().iter().find(|(_, e)| *e == 2).map(|s| s.0)
+ })
+ .await;
assert_ne!(first, second, "{v:?}");
assert_eq!(v.node, lab.hosts[second].name);
assert_eq!(lab.starts_of(2), 1);