in src/rust/engine/process_execution/src/remote.rs [1433:1516]
fn ensure_inline_stdio_is_stored() {
let mut runtime = tokio::runtime::Runtime::new().unwrap();
let test_stdout = TestData::roland();
let test_stderr = TestData::catnip();
let mock_server = {
let op_name = "cat".to_owned();
mock::execution_server::TestServer::new(mock::execution_server::MockExecution::new(
op_name.clone(),
super::make_execute_request(&echo_roland_request(), &None, &None, BTreeMap::new())
.unwrap()
.2,
vec![make_successful_operation(
&op_name.clone(),
StdoutType::Raw(test_stdout.string()),
StderrType::Raw(test_stderr.string()),
0,
)],
))
};
let store_dir = TempDir::new().unwrap();
let store_dir_path = store_dir.path();
let cas = mock::StubCAS::empty();
let timer_thread = timer_thread();
let store = fs::Store::with_remote(
&store_dir_path,
&[cas.address()],
None,
&None,
None,
1,
10 * 1024 * 1024,
Duration::from_secs(1),
fs::BackoffConfig::new(Duration::from_millis(10), 1.0, Duration::from_millis(10)).unwrap(),
1,
timer_thread.with(|t| t.handle()),
)
.expect("Failed to make store");
let cmd_runner = CommandRunner::new(
&mock_server.address(),
None,
None,
None,
None,
BTreeMap::new(),
1,
store,
timer_thread,
);
let result = runtime
.block_on(cmd_runner.run(echo_roland_request()))
.unwrap();
assert_eq!(
result.without_execution_attempts(),
FallibleExecuteProcessResult {
stdout: test_stdout.bytes(),
stderr: test_stderr.bytes(),
exit_code: 0,
output_directory: fs::EMPTY_DIGEST,
execution_attempts: vec![],
}
);
let local_store = fs::Store::local_only(&store_dir_path).expect("Error creating local store");
{
assert_eq!(
runtime
.block_on(local_store.load_file_bytes_with(test_stdout.digest(), |v| v))
.unwrap(),
Some(test_stdout.bytes())
);
assert_eq!(
runtime
.block_on(local_store.load_file_bytes_with(test_stderr.digest(), |v| v))
.unwrap(),
Some(test_stderr.bytes())
);
}
}