in src/rust/engine/process_execution/src/remote.rs [1881:1971]
fn execute_missing_file_uploads_if_known_status() {
let roland = TestData::roland();
let mock_server = {
let op_name = "cat".to_owned();
let status = grpcio::RpcStatus {
status: grpcio::RpcStatusCode::FailedPrecondition,
details: None,
status_proto_bytes: Some(
make_precondition_failure_status(vec![missing_preconditionfailure_violation(
&roland.digest(),
)])
.write_to_bytes()
.unwrap(),
),
};
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),
MockOperation {
op: Err(status),
duration: None,
},
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");
store
.store_file_bytes(roland.bytes(), false)
.wait()
.expect("Saving file bytes to store");
let result = CommandRunner::new(
&mock_server.address(),
None,
None,
None,
None,
BTreeMap::new(),
1,
store,
timer_thread,
)
.run(cat_roland_request())
.wait();
assert_eq!(
result,
Ok(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()));
}
}