Skip to content

Commit 92ca47d

Browse files
jeremymanningclaude
andcommitted
fix: use cross-platform temp paths for Windows CI compatibility
Replace hardcoded /tmp/ paths with std::env::temp_dir() in: - scheduler/coordinator.rs (raft WAL test) - sandbox/wasm.rs (WASM sandbox tests) - agent/config.rs (default work_dir) - cli/submitter.rs (submit test) Fixes Windows CI failure: raft_storage_with_wal panicked on /tmp path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d939754 commit 92ca47d

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/agent/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct AgentConfig {
2323
impl Default for AgentConfig {
2424
fn default() -> Self {
2525
Self {
26-
work_dir: PathBuf::from("/tmp/worldcompute"),
26+
work_dir: std::env::temp_dir().join("worldcompute"),
2727
cpu_cap_percent: 80,
2828
storage_cap_bytes: 10 * 1024 * 1024 * 1024, // 10 GB
2929
otel_endpoint: None,

src/cli/submitter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ mod tests {
7575

7676
#[test]
7777
fn submit_returns_manifest_path_in_message() {
78-
let msg = execute(&JobCommand::Submit { manifest_path: "/tmp/job.json".into() });
79-
assert!(msg.contains("/tmp/job.json"));
78+
let test_path = std::env::temp_dir().join("job.json");
79+
let test_path_str = test_path.to_string_lossy().to_string();
80+
let msg = execute(&JobCommand::Submit { manifest_path: test_path_str.clone() });
81+
assert!(msg.contains(&test_path_str));
8082
}
8183

8284
#[test]

src/sandbox/wasm.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ mod tests {
204204
#[test]
205205
fn wasm_engine_initializes() {
206206
let store = CidStore::new();
207-
let sandbox = WasmSandbox::new(std::path::PathBuf::from("/tmp/wc-test-wasm"), store);
207+
let sandbox = WasmSandbox::new(std::env::temp_dir().join("wc-test-wasm"), store);
208208
assert!(sandbox.is_ok());
209209
}
210210

211211
#[test]
212212
fn wasm_create_fails_for_missing_cid() {
213213
let store = CidStore::new();
214214
let mut sandbox =
215-
WasmSandbox::new(std::path::PathBuf::from("/tmp/wc-test-wasm-missing"), store).unwrap();
215+
WasmSandbox::new(std::env::temp_dir().join("wc-test-wasm-missing"), store).unwrap();
216216
let cid = crate::data_plane::cid_store::compute_cid(b"nonexistent").unwrap();
217217
assert!(sandbox.create(&cid).is_err());
218218
}
@@ -224,7 +224,7 @@ mod tests {
224224
let cid = store.put(&wasm_bytes).unwrap();
225225

226226
let mut sandbox =
227-
WasmSandbox::new(std::path::PathBuf::from("/tmp/wc-test-wasm-run"), store).unwrap();
227+
WasmSandbox::new(std::env::temp_dir().join("wc-test-wasm-run"), store).unwrap();
228228
assert!(sandbox.create(&cid).is_ok());
229229
assert!(sandbox.start().is_ok());
230230
assert!(sandbox.terminate().is_ok());
@@ -237,7 +237,7 @@ mod tests {
237237
let cid = store.put(bad_bytes).unwrap();
238238

239239
let mut sandbox =
240-
WasmSandbox::new(std::path::PathBuf::from("/tmp/wc-test-wasm-bad"), store).unwrap();
240+
WasmSandbox::new(std::env::temp_dir().join("wc-test-wasm-bad"), store).unwrap();
241241
let result = sandbox.create(&cid);
242242
assert!(result.is_err());
243243
assert!(result.unwrap_err().to_string().contains("compilation failed"));
@@ -250,8 +250,7 @@ mod tests {
250250
let cid = store.put(&wasm_bytes).unwrap();
251251

252252
let mut sandbox =
253-
WasmSandbox::new(std::path::PathBuf::from("/tmp/wc-test-wasm-lifecycle"), store)
254-
.unwrap();
253+
WasmSandbox::new(std::env::temp_dir().join("wc-test-wasm-lifecycle"), store).unwrap();
255254
assert!(sandbox.create(&cid).is_ok());
256255
assert!(sandbox.start().is_ok());
257256
assert!(sandbox.freeze().is_ok());

src/scheduler/coordinator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ mod tests {
446446

447447
#[test]
448448
fn raft_storage_with_wal() {
449-
let wal_path = std::path::PathBuf::from("/tmp/wc-test-raft-wal.json");
449+
let wal_path = std::env::temp_dir().join("wc-test-raft-wal.json");
450450
let mut storage = RaftCoordinatorStorage::with_wal(wal_path.clone());
451451
let entry = RaftLogEntry { term: 1, index: 1, action: CoordinatorAction::Noop };
452452
assert!(storage.append(entry).is_ok());

0 commit comments

Comments
 (0)