..self
}
}
pub(crate) fn expected_exit_code(self, expected_exit_code: i32) -> Self {
Self {
expected_exit_code,
..self
}
}
pub(crate) fn temp_dir(self, tempdir: TempDir) -> Self {
Self { tempdir, ..self }
}
pub(crate) fn command(&self) -> Command {
let mut command = Command::new(executable_path("ord"));
if let Some(rpc_server_url) = &self.rpc_server_url {
let cookiefile = self.tempdir.path().join("cookie");
fs::write(&cookiefile, "username:password").unwrap();
command.args([
"--rpc-url",
rpc_server_url,
"--cookie-file",
cookiefile.to_str().unwrap(),
]);
}
command
.env("ORD_INTEGRATION_TEST", "1")
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.current_dir(&self.tempdir)
.arg("--data-dir")
.arg(self.tempdir.path())
.args(&self.args);
command
}
fn run(self) -> (TempDir, String) {
let child = self.command().spawn().unwrap();