in src/rust/engine/process_execution/src/remote.rs [1794:1876]
fn execute_missing_file_uploads_if_known() {
let mut runtime = tokio::runtime::Runtime::new().unwrap();
let roland = TestData::roland();
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(&cat_roland_request(), &None, &None, BTreeMap::new())
.unwrap()
.2,
vec![
make_incomplete_operation(&op_name),
make_precondition_failure_operation(vec![missing_preconditionfailure_violation(
&roland.digest(),
)]),
make_successful_operation(
"cat2",
StdoutType::Raw(roland.string()),
StderrType::Raw("".to_owned()),
0,
),
],
))
};
let store_dir = TempDir::new().unwrap();
let cas = mock::StubCAS::builder()
.directory(&TestDirectory::containing_roland())
.build();
let timer_thread = timer_thread();
let store = fs::Store::with_remote(
store_dir,
&[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");
runtime
.block_on(store.store_file_bytes(roland.bytes(), false))
.expect("Saving file bytes to store");
runtime
.block_on(store.record_directory(&TestDirectory::containing_roland().directory(), false))
.expect("Saving directory bytes to store");
let command_runner = CommandRunner::new(
&mock_server.address(),
None,
None,
None,
None,
BTreeMap::new(),
1,
store,
timer_thread,
);
let result = runtime
.block_on(command_runner.run(cat_roland_request()))
.unwrap();
assert_eq!(
result.without_execution_attempts(),
FallibleExecuteProcessResult {
stdout: roland.bytes(),
stderr: Bytes::from(""),
exit_code: 0,
output_directory: fs::EMPTY_DIGEST,
execution_attempts: vec![],
}
);
{
let blobs = cas.blobs.lock();
assert_eq!(blobs.get(&roland.fingerprint()), Some(&roland.bytes()));
}
}