in src/rust/engine/process_execution/src/remote.rs [1091:1167]
fn make_execute_request_with_cache_key_gen_version() {
let input_directory = TestDirectory::containing_roland();
let req = ExecuteProcessRequest {
argv: owned_string_vec(&["/bin/echo", "yo"]),
env: vec![("SOME".to_owned(), "value".to_owned())]
.into_iter()
.collect(),
input_files: input_directory.digest(),
// Intentionally poorly sorted:
output_files: vec!["path/to/file", "other/file"]
.into_iter()
.map(PathBuf::from)
.collect(),
output_directories: vec!["directory/name"]
.into_iter()
.map(PathBuf::from)
.collect(),
timeout: Duration::from_millis(1000),
description: "some description".to_owned(),
jdk_home: None,
};
let mut want_command = bazel_protos::remote_execution::Command::new();
want_command.mut_arguments().push("/bin/echo".to_owned());
want_command.mut_arguments().push("yo".to_owned());
want_command.mut_environment_variables().push({
let mut env = bazel_protos::remote_execution::Command_EnvironmentVariable::new();
env.set_name("SOME".to_owned());
env.set_value("value".to_owned());
env
});
want_command.mut_environment_variables().push({
let mut env = bazel_protos::remote_execution::Command_EnvironmentVariable::new();
env.set_name(super::CACHE_KEY_GEN_VERSION_ENV_VAR_NAME.to_owned());
env.set_value("meep".to_owned());
env
});
want_command
.mut_output_files()
.push("other/file".to_owned());
want_command
.mut_output_files()
.push("path/to/file".to_owned());
want_command
.mut_output_directories()
.push("directory/name".to_owned());
let mut want_action = bazel_protos::remote_execution::Action::new();
want_action.set_command_digest(
(&Digest(
Fingerprint::from_hex_string(
"1a95e3482dd235593df73dc12b808ec7d922733a40d97d8233c1a32c8610a56d",
)
.unwrap(),
109,
))
.into(),
);
want_action.set_input_root_digest((&input_directory.digest()).into());
let mut want_execute_request = bazel_protos::remote_execution::ExecuteRequest::new();
want_execute_request.set_action_digest(
(&Digest(
Fingerprint::from_hex_string(
"0ee5d4c8ac12513a87c8d949c6883ac533a264d30215126af71a9028c4ab6edf",
)
.unwrap(),
140,
))
.into(),
);
assert_eq!(
super::make_execute_request(&req, &None, &Some("meep".to_owned()), BTreeMap::new()),
Ok((want_action, want_command, want_execute_request))
);
}