Rename repl -> api

pull/172/head
Chip Senkbeil 1 year ago
parent 759394d0e1
commit 781f4b3ca5
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -231,20 +231,12 @@ async fn async_run(cmd: ClientSubcommand) -> CliResult {
),
}
}
ClientSubcommand::Repl {
ClientSubcommand::Api {
cache,
connection,
format,
network,
timeout,
} => {
// TODO: Support shell format?
if !format.is_json() {
return Err(CliError::Error(anyhow::anyhow!(
"Only JSON format is supported"
)));
}
debug!("Connecting to manager");
let mut client = Client::new(network)
.using_json_auth_handler()
@ -277,7 +269,7 @@ async fn async_run(cmd: ClientSubcommand) -> CliResult {
}
);
debug!("Starting repl using format {:?}", format);
debug!("Starting api tasks");
let (msg_tx, mut msg_rx) = mpsc::channel(1);
let request_task = tokio::spawn(async move {
let mut rx =

@ -94,6 +94,12 @@ impl Options {
DistantSubcommand::Client(cmd) => {
update_logging!(client);
match cmd {
ClientSubcommand::Api {
network, timeout, ..
} => {
network.merge(config.client.network);
*timeout = timeout.take().or(config.client.api.timeout);
}
ClientSubcommand::Capabilities { network, .. } => {
network.merge(config.client.network);
}
@ -134,12 +140,6 @@ impl Options {
.take()
.or(config.client.launch.distant.bind_server);
}
ClientSubcommand::Repl {
network, timeout, ..
} => {
network.merge(config.client.network);
*timeout = timeout.take().or(config.client.repl.timeout);
}
ClientSubcommand::Shell { network, .. } => {
network.merge(config.client.network);
}
@ -236,6 +236,29 @@ pub enum DistantSubcommand {
/// Subcommands for `distant client`.
#[derive(Debug, PartialEq, Subcommand, IsVariant)]
pub enum ClientSubcommand {
/// Listen over stdin & stdout to communicate with a distant server using the JSON lines API
Api {
/// Location to store cached data
#[clap(
long,
value_hint = ValueHint::FilePath,
value_parser,
default_value = CACHE_FILE_PATH_STR.as_str()
)]
cache: PathBuf,
/// Represents the maximum time (in seconds) to wait for a network request before timing out.
#[clap(long)]
timeout: Option<f32>,
/// Specify a connection being managed
#[clap(long)]
connection: Option<ConnectionId>,
#[clap(flatten)]
network: NetworkSettings,
},
/// Retrieves capabilities of the remote server
Capabilities {
/// Location to store cached data
@ -341,33 +364,6 @@ pub enum ClientSubcommand {
destination: Box<Destination>,
},
/// Runs actions in a read-eval-print loop
Repl {
/// Location to store cached data
#[clap(
long,
value_hint = ValueHint::FilePath,
value_parser,
default_value = CACHE_FILE_PATH_STR.as_str()
)]
cache: PathBuf,
/// Represents the maximum time (in seconds) to wait for a network request before timing out.
#[clap(long)]
timeout: Option<f32>,
/// Specify a connection being managed
#[clap(long)]
connection: Option<ConnectionId>,
#[clap(flatten)]
network: NetworkSettings,
/// Format used for input into and output from the repl
#[clap(short, long, default_value_t, value_enum)]
format: Format,
},
/// Specialized treatment of running a remote shell process
Shell {
/// Location to store cached data
@ -465,7 +461,7 @@ impl ClientSubcommand {
Self::Connect { cache, .. } => cache.as_path(),
Self::FileSystem(fs) => fs.cache_path(),
Self::Launch { cache, .. } => cache.as_path(),
Self::Repl { cache, .. } => cache.as_path(),
Self::Api { cache, .. } => cache.as_path(),
Self::Shell { cache, .. } => cache.as_path(),
Self::Spawn { cache, .. } => cache.as_path(),
Self::SystemInfo { cache, .. } => cache.as_path(),
@ -478,7 +474,7 @@ impl ClientSubcommand {
Self::Connect { network, .. } => network,
Self::FileSystem(fs) => fs.network_settings(),
Self::Launch { network, .. } => network,
Self::Repl { network, .. } => network,
Self::Api { network, .. } => network,
Self::Shell { network, .. } => network,
Self::Spawn { network, .. } => network,
Self::SystemInfo { network, .. } => network,
@ -1114,21 +1110,21 @@ mod tests {
use std::time::Duration;
#[test]
fn distant_capabilities_should_support_merging_with_config() {
fn distant_api_should_support_merging_with_config() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: None,
log_level: None,
},
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
command: DistantSubcommand::Client(ClientSubcommand::Api {
cache: PathBuf::new(),
connection: None,
network: NetworkSettings {
unix_socket: None,
windows_pipe: None,
},
format: Format::Json,
timeout: None,
}),
};
@ -1142,9 +1138,7 @@ mod tests {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
connect: ClientConnectConfig {
options: map!("hello" -> "world"),
},
api: ClientApiConfig { timeout: Some(5.0) },
..Default::default()
},
..Default::default()
@ -1158,35 +1152,35 @@ mod tests {
log_file: Some(PathBuf::from("config-log-file")),
log_level: Some(LogLevel::Trace),
},
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
command: DistantSubcommand::Client(ClientSubcommand::Api {
cache: PathBuf::new(),
connection: None,
network: NetworkSettings {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
format: Format::Json,
timeout: Some(5.0),
}),
}
);
}
#[test]
fn distant_capabilities_should_prioritize_explicit_cli_options_when_merging() {
fn distant_api_should_prioritize_explicit_cli_options_when_merging() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
command: DistantSubcommand::Client(ClientSubcommand::Api {
cache: PathBuf::new(),
connection: None,
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
windows_pipe: Some(String::from("cli-windows-pipe")),
},
format: Format::Json,
timeout: Some(99.0),
}),
};
@ -1200,9 +1194,7 @@ mod tests {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
connect: ClientConnectConfig {
options: map!("hello" -> "world", "config" -> "value"),
},
api: ClientApiConfig { timeout: Some(5.0) },
..Default::default()
},
..Default::default()
@ -1216,36 +1208,35 @@ mod tests {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
command: DistantSubcommand::Client(ClientSubcommand::Api {
cache: PathBuf::new(),
connection: None,
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
windows_pipe: Some(String::from("cli-windows-pipe")),
},
format: Format::Json,
timeout: Some(99.0),
}),
}
);
}
#[test]
fn distant_connect_should_support_merging_with_config() {
fn distant_capabilities_should_support_merging_with_config() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: None,
log_level: None,
},
command: DistantSubcommand::Client(ClientSubcommand::Connect {
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
cache: PathBuf::new(),
options: map!(),
connection: None,
network: NetworkSettings {
unix_socket: None,
windows_pipe: None,
},
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
};
@ -1275,37 +1266,35 @@ mod tests {
log_file: Some(PathBuf::from("config-log-file")),
log_level: Some(LogLevel::Trace),
},
command: DistantSubcommand::Client(ClientSubcommand::Connect {
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
cache: PathBuf::new(),
options: map!("hello" -> "world"),
connection: None,
network: NetworkSettings {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
}
);
}
#[test]
fn distant_connect_should_prioritize_explicit_cli_options_when_merging() {
fn distant_capabilities_should_prioritize_explicit_cli_options_when_merging() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Connect {
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
cache: PathBuf::new(),
options: map!("hello" -> "test", "cli" -> "value"),
connection: None,
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
windows_pipe: Some(String::from("cli-windows-pipe")),
},
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
};
@ -1335,33 +1324,29 @@ mod tests {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Connect {
command: DistantSubcommand::Client(ClientSubcommand::Capabilities {
cache: PathBuf::new(),
options: map!("hello" -> "test", "cli" -> "value", "config" -> "value"),
connection: None,
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
windows_pipe: Some(String::from("cli-windows-pipe")),
},
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
}
);
}
#[test]
fn distant_launch_should_support_merging_with_config() {
fn distant_connect_should_support_merging_with_config() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: None,
log_level: None,
},
command: DistantSubcommand::Client(ClientSubcommand::Launch {
command: DistantSubcommand::Client(ClientSubcommand::Connect {
cache: PathBuf::new(),
distant_bin: None,
distant_bind_server: None,
distant_args: None,
options: map!(),
network: NetworkSettings {
unix_socket: None,
@ -1382,14 +1367,7 @@ mod tests {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
launch: ClientLaunchConfig {
distant: ClientLaunchDistantConfig {
args: Some(String::from("config-args")),
bin: Some(String::from("config-bin")),
bind_server: Some(BindAddress::Host(Host::Name(String::from(
"config-host",
)))),
},
connect: ClientConnectConfig {
options: map!("hello" -> "world"),
},
..Default::default()
@ -1405,13 +1383,8 @@ mod tests {
log_file: Some(PathBuf::from("config-log-file")),
log_level: Some(LogLevel::Trace),
},
command: DistantSubcommand::Client(ClientSubcommand::Launch {
command: DistantSubcommand::Client(ClientSubcommand::Connect {
cache: PathBuf::new(),
distant_args: Some(String::from("config-args")),
distant_bin: Some(String::from("config-bin")),
distant_bind_server: Some(BindAddress::Host(Host::Name(String::from(
"config-host",
)))),
options: map!("hello" -> "world"),
network: NetworkSettings {
unix_socket: Some(PathBuf::from("config-unix-socket")),
@ -1425,18 +1398,15 @@ mod tests {
}
#[test]
fn distant_launch_should_prioritize_explicit_cli_options_when_merging() {
fn distant_connect_should_prioritize_explicit_cli_options_when_merging() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Launch {
command: DistantSubcommand::Client(ClientSubcommand::Connect {
cache: PathBuf::new(),
distant_args: Some(String::from("cli-args")),
distant_bin: Some(String::from("cli-bin")),
distant_bind_server: Some(BindAddress::Host(Host::Name(String::from("cli-host")))),
options: map!("hello" -> "test", "cli" -> "value"),
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
@ -1457,14 +1427,7 @@ mod tests {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
launch: ClientLaunchConfig {
distant: ClientLaunchDistantConfig {
args: Some(String::from("config-args")),
bin: Some(String::from("config-bin")),
bind_server: Some(BindAddress::Host(Host::Name(String::from(
"config-host",
)))),
},
connect: ClientConnectConfig {
options: map!("hello" -> "world", "config" -> "value"),
},
..Default::default()
@ -1480,14 +1443,9 @@ mod tests {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Launch {
command: DistantSubcommand::Client(ClientSubcommand::Connect {
cache: PathBuf::new(),
distant_args: Some(String::from("cli-args")),
distant_bin: Some(String::from("cli-bin")),
distant_bind_server: Some(BindAddress::Host(Host::Name(String::from(
"cli-host",
)))),
options: map!("hello" -> "test", "config" -> "value", "cli" -> "value"),
options: map!("hello" -> "test", "cli" -> "value", "config" -> "value"),
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
windows_pipe: Some(String::from("cli-windows-pipe")),
@ -1500,22 +1458,25 @@ mod tests {
}
#[test]
fn distant_repl_should_support_merging_with_config() {
fn distant_launch_should_support_merging_with_config() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: None,
log_level: None,
},
command: DistantSubcommand::Client(ClientSubcommand::Repl {
command: DistantSubcommand::Client(ClientSubcommand::Launch {
cache: PathBuf::new(),
connection: None,
format: Format::Json,
distant_bin: None,
distant_bind_server: None,
distant_args: None,
options: map!(),
network: NetworkSettings {
unix_socket: None,
windows_pipe: None,
},
timeout: None,
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
};
@ -1529,7 +1490,16 @@ mod tests {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
repl: ClientReplConfig { timeout: Some(5.0) },
launch: ClientLaunchConfig {
distant: ClientLaunchDistantConfig {
args: Some(String::from("config-args")),
bin: Some(String::from("config-bin")),
bind_server: Some(BindAddress::Host(Host::Name(String::from(
"config-host",
)))),
},
options: map!("hello" -> "world"),
},
..Default::default()
},
..Default::default()
@ -1543,37 +1513,45 @@ mod tests {
log_file: Some(PathBuf::from("config-log-file")),
log_level: Some(LogLevel::Trace),
},
command: DistantSubcommand::Client(ClientSubcommand::Repl {
command: DistantSubcommand::Client(ClientSubcommand::Launch {
cache: PathBuf::new(),
connection: None,
format: Format::Json,
distant_args: Some(String::from("config-args")),
distant_bin: Some(String::from("config-bin")),
distant_bind_server: Some(BindAddress::Host(Host::Name(String::from(
"config-host",
)))),
options: map!("hello" -> "world"),
network: NetworkSettings {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
timeout: Some(5.0),
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
}
);
}
#[test]
fn distant_repl_should_prioritize_explicit_cli_options_when_merging() {
fn distant_launch_should_prioritize_explicit_cli_options_when_merging() {
let mut options = Options {
config_path: None,
logging: LoggingSettings {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Repl {
command: DistantSubcommand::Client(ClientSubcommand::Launch {
cache: PathBuf::new(),
connection: None,
format: Format::Json,
distant_args: Some(String::from("cli-args")),
distant_bin: Some(String::from("cli-bin")),
distant_bind_server: Some(BindAddress::Host(Host::Name(String::from("cli-host")))),
options: map!("hello" -> "test", "cli" -> "value"),
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
windows_pipe: Some(String::from("cli-windows-pipe")),
},
timeout: Some(99.0),
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
};
@ -1587,7 +1565,16 @@ mod tests {
unix_socket: Some(PathBuf::from("config-unix-socket")),
windows_pipe: Some(String::from("config-windows-pipe")),
},
repl: ClientReplConfig { timeout: Some(5.0) },
launch: ClientLaunchConfig {
distant: ClientLaunchDistantConfig {
args: Some(String::from("config-args")),
bin: Some(String::from("config-bin")),
bind_server: Some(BindAddress::Host(Host::Name(String::from(
"config-host",
)))),
},
options: map!("hello" -> "world", "config" -> "value"),
},
..Default::default()
},
..Default::default()
@ -1601,15 +1588,20 @@ mod tests {
log_file: Some(PathBuf::from("cli-log-file")),
log_level: Some(LogLevel::Info),
},
command: DistantSubcommand::Client(ClientSubcommand::Repl {
command: DistantSubcommand::Client(ClientSubcommand::Launch {
cache: PathBuf::new(),
connection: None,
format: Format::Json,
distant_args: Some(String::from("cli-args")),
distant_bin: Some(String::from("cli-bin")),
distant_bind_server: Some(BindAddress::Host(Host::Name(String::from(
"cli-host",
)))),
options: map!("hello" -> "test", "config" -> "value", "cli" -> "value"),
network: NetworkSettings {
unix_socket: Some(PathBuf::from("cli-unix-socket")),
windows_pipe: Some(String::from("cli-windows-pipe")),
},
timeout: Some(99.0),
format: Format::Json,
destination: Box::new("test://destination".parse().unwrap()),
}),
}
);

@ -108,6 +108,7 @@ mod tests {
config,
Config {
client: ClientConfig {
api: ClientApiConfig { timeout: Some(0.) },
connect: ClientConnectConfig {
options: Map::new()
},
@ -127,7 +128,6 @@ mod tests {
unix_socket: None,
windows_pipe: None
},
repl: ClientReplConfig { timeout: Some(0.) },
},
generate: GenerateConfig {
logging: LoggingSettings {
@ -176,6 +176,9 @@ log_level = "trace"
unix_socket = "client-unix-socket"
windows_pipe = "client-windows-pipe"
[client.api]
timeout = 456
[client.connect]
options = "key=\"value\",key2=\"value2\""
@ -185,9 +188,6 @@ bind_server = "any"
args = "a b c"
options = "key3=\"value3\",key4=\"value4\""
[client.repl]
timeout = 456
[generate]
log_file = "generate-log-file"
log_level = "debug"
@ -218,6 +218,9 @@ current_dir = "server-current-dir"
config,
Config {
client: ClientConfig {
api: ClientApiConfig {
timeout: Some(456.)
},
connect: ClientConnectConfig {
options: map!("key" -> "value", "key2" -> "value2"),
},
@ -237,9 +240,6 @@ current_dir = "server-current-dir"
unix_socket: Some(PathBuf::from("client-unix-socket")),
windows_pipe: Some(String::from("client-windows-pipe"))
},
repl: ClientReplConfig {
timeout: Some(456.)
},
},
generate: GenerateConfig {
logging: LoggingSettings {

@ -15,6 +15,13 @@
# The default setting is info
log_level = "info"
# Configuration related to the client's api command
[client.api]
# Maximum time (in seconds) to wait for a network request before timing out
# where 0 indicates no timeout will occur
timeout = 0
# Alternative unix domain socket to connect to when using a manger (Unix only)
# unix_socket = "path/to/socket"
@ -65,13 +72,6 @@ args = ""
# E.g. `key="value",key2="value2"`
options = ""
# Configuration related to the client's repl command
[client.repl]
# Maximum time (in seconds) to wait for a network request before timing out
# where 0 indicates no timeout will occur
timeout = 0
###############################################################################
# All configuration specific to the distant generate option will be found under
# this heading

@ -1,13 +1,13 @@
use super::common::{self, LoggingSettings, NetworkSettings};
use serde::{Deserialize, Serialize};
mod api;
mod connect;
mod launch;
mod repl;
pub use api::*;
pub use connect::*;
pub use launch::*;
pub use repl::*;
/// Represents configuration settings for the distant client
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
@ -18,7 +18,7 @@ pub struct ClientConfig {
#[serde(flatten)]
pub network: NetworkSettings,
pub api: ClientApiConfig,
pub connect: ClientConnectConfig,
pub launch: ClientLaunchConfig,
pub repl: ClientReplConfig,
}

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClientReplConfig {
pub struct ClientApiConfig {
pub timeout: Option<f32>,
}

@ -6,8 +6,8 @@ use test_log::test;
#[rstest]
#[test(tokio::test)]
async fn should_support_json_capabilities(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_capabilities(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let id = rand::random::<u64>().to_string();
let req = json!({
@ -15,7 +15,7 @@ async fn should_support_json_capabilities(mut json_repl: CtxCommand<Repl>) {
"payload": { "type": "capabilities" },
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "capabilities", "JSON: {res}");

@ -13,8 +13,8 @@ that is a file's contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_copying_file(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_copying_file(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -33,7 +33,7 @@ async fn should_support_json_copying_file(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -50,8 +50,8 @@ async fn should_support_json_copying_file(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_copying_nonempty_directory(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_copying_nonempty_directory(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -74,7 +74,7 @@ async fn should_support_json_copying_nonempty_directory(mut json_repl: CtxComman
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -91,8 +91,8 @@ async fn should_support_json_copying_nonempty_directory(mut json_repl: CtxComman
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -109,7 +109,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -7,8 +7,8 @@ use test_log::test;
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let dir = temp.child("dir");
@ -23,7 +23,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -41,9 +41,9 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_creating_missing_parent_directories_if_specified(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let dir = temp.child("dir1").child("dir2");
@ -58,7 +58,7 @@ async fn should_support_json_creating_missing_parent_directories_if_specified(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -75,8 +75,8 @@ async fn should_support_json_creating_missing_parent_directories_if_specified(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let dir = temp.child("missing-dir").child("dir");
@ -91,7 +91,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -71,8 +71,8 @@ fn make_directory() -> assert_fs::TempDir {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = make_directory();
@ -89,7 +89,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -111,9 +111,9 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_returning_absolute_paths_if_specified(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = make_directory();
@ -134,7 +134,7 @@ async fn should_support_json_returning_absolute_paths_if_specified(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -156,9 +156,9 @@ async fn should_support_json_returning_absolute_paths_if_specified(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_returning_all_files_and_directories_if_depth_is_0(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = make_directory();
@ -175,7 +175,7 @@ async fn should_support_json_returning_all_files_and_directories_if_depth_is_0(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -207,9 +207,9 @@ async fn should_support_json_returning_all_files_and_directories_if_depth_is_0(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_including_root_directory_if_specified(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = make_directory();
@ -230,7 +230,7 @@ async fn should_support_json_including_root_directory_if_specified(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -252,8 +252,8 @@ async fn should_support_json_including_root_directory_if_specified(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = make_directory();
let dir = temp.child("missing-dir");
@ -271,7 +271,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -6,8 +6,8 @@ use test_log::test;
#[rstest]
#[test(tokio::test)]
async fn should_support_json_true_if_exists(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_true_if_exists(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -24,7 +24,7 @@ async fn should_support_json_true_if_exists(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -39,8 +39,8 @@ async fn should_support_json_true_if_exists(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_false_if_not_exists(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_false_if_not_exists(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -56,7 +56,7 @@ async fn should_support_json_false_if_not_exists(mut json_repl: CtxCommand<Repl>
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(

@ -17,8 +17,8 @@ file contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("test-file");
@ -34,7 +34,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -54,8 +54,8 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("missing-dir").child("missing-file");
@ -70,7 +70,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -17,8 +17,8 @@ file contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("test-file");
@ -34,7 +34,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -54,8 +54,8 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("missing-dir").child("missing-file");
@ -70,7 +70,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -12,8 +12,8 @@ that is a file's contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("test-file");
@ -28,7 +28,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -43,8 +43,8 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("missing-file");
@ -58,7 +58,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -12,8 +12,8 @@ that is a file's contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("test-file");
@ -28,7 +28,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -43,8 +43,8 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("missing-file");
@ -58,7 +58,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -12,8 +12,8 @@ that is a file's contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("test-file");
@ -28,7 +28,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -48,8 +48,8 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("missing-dir").child("missing-file");
@ -64,7 +64,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -12,8 +12,8 @@ that is a file's contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("test-file");
@ -28,7 +28,7 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -48,8 +48,8 @@ async fn should_support_json_output(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let file = temp.child("missing-dir").child("missing-file");
@ -64,7 +64,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -12,8 +12,8 @@ that is a file's contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_metadata_for_file(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_metadata_for_file(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -31,7 +31,7 @@ async fn should_support_json_metadata_for_file(mut json_repl: CtxCommand<Repl>)
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "metadata", "JSON: {res}");
@ -46,8 +46,8 @@ async fn should_support_json_metadata_for_file(mut json_repl: CtxCommand<Repl>)
#[rstest]
#[test(tokio::test)]
async fn should_support_json_metadata_for_directory(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_metadata_for_directory(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -65,7 +65,7 @@ async fn should_support_json_metadata_for_directory(mut json_repl: CtxCommand<Re
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "metadata", "JSON: {res}");
@ -81,9 +81,9 @@ async fn should_support_json_metadata_for_directory(mut json_repl: CtxCommand<Re
#[rstest]
#[test(tokio::test)]
async fn should_support_json_metadata_for_including_a_canonicalized_path(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -104,7 +104,7 @@ async fn should_support_json_metadata_for_including_a_canonicalized_path(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "metadata", "JSON: {res}");
@ -120,9 +120,9 @@ async fn should_support_json_metadata_for_including_a_canonicalized_path(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_metadata_for_resolving_file_type_of_symlink(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -143,7 +143,7 @@ async fn should_support_json_metadata_for_resolving_file_type_of_symlink(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "metadata", "JSON: {res}");
@ -152,8 +152,8 @@ async fn should_support_json_metadata_for_resolving_file_type_of_symlink(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -171,7 +171,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -72,9 +72,9 @@ fn check_value_as_str(value: &serde_json::Value, other: &str) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_to_execute_program_and_return_exit_status(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let cmd = make_cmd(vec![ECHO_ARGS_TO_STDOUT.to_str().unwrap()]);
@ -88,7 +88,7 @@ async fn should_support_json_to_execute_program_and_return_exit_status(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_spawned", "JSON: {res}");
@ -96,8 +96,8 @@ async fn should_support_json_to_execute_program_and_return_exit_status(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_to_capture_and_print_stdout(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_to_capture_and_print_stdout(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let cmd = make_cmd(vec![ECHO_ARGS_TO_STDOUT.to_str().unwrap(), "some output"]);
@ -112,20 +112,20 @@ async fn should_support_json_to_capture_and_print_stdout(mut json_repl: CtxComma
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_spawned", "JSON: {res}");
// Wait for output to show up (for stderr)
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_stdout", "JSON: {res}");
check_value_as_str(&res["payload"]["data"], "some output");
// Now we wait for the process to complete
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_done", "JSON: {res}");
@ -134,8 +134,8 @@ async fn should_support_json_to_capture_and_print_stdout(mut json_repl: CtxComma
#[rstest]
#[test(tokio::test)]
async fn should_support_json_to_capture_and_print_stderr(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_to_capture_and_print_stderr(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let cmd = make_cmd(vec![ECHO_ARGS_TO_STDERR.to_str().unwrap(), "some output"]);
@ -150,20 +150,20 @@ async fn should_support_json_to_capture_and_print_stderr(mut json_repl: CtxComma
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_spawned", "JSON: {res}");
// Wait for output to show up (for stderr)
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_stderr", "JSON: {res}");
check_value_as_str(&res["payload"]["data"], "some output");
// Now we wait for the process to complete
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_done", "JSON: {res}");
@ -172,8 +172,10 @@ async fn should_support_json_to_capture_and_print_stderr(mut json_repl: CtxComma
#[rstest]
#[test(tokio::test)]
async fn should_support_json_to_forward_stdin_to_remote_process(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_to_forward_stdin_to_remote_process(
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut api_process).await;
let cmd = make_cmd(vec![ECHO_STDIN_TO_STDOUT.to_str().unwrap()]);
@ -188,7 +190,7 @@ async fn should_support_json_to_forward_stdin_to_remote_process(mut json_repl: C
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_spawned", "JSON: {res}");
@ -207,12 +209,12 @@ async fn should_support_json_to_forward_stdin_to_remote_process(mut json_repl: C
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "ok", "JSON: {res}");
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], origin_id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "proc_stdout", "JSON: {res}");
@ -220,7 +222,7 @@ async fn should_support_json_to_forward_stdin_to_remote_process(mut json_repl: C
// Now kill the process and wait for it to complete
let id = rand::random::<u64>().to_string();
let res = json_repl
let res = api_process
.write_and_read_json(json!({
"id": id,
"payload": {
@ -237,7 +239,7 @@ async fn should_support_json_to_forward_stdin_to_remote_process(mut json_repl: C
//
// NOTE: The above is a situation in Windows, but I've not seen it happen with Mac/Linux.
if res["payload"]["type"] == "ok" {
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(
res["payload"]["type"], "proc_done",
"Did not receive proc_done from killed process: {res}"
@ -249,8 +251,8 @@ async fn should_support_json_to_forward_stdin_to_remote_process(mut json_repl: C
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let id = rand::random::<u64>().to_string();
let req = json!({
@ -262,7 +264,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -7,8 +7,8 @@ use test_log::test;
#[rstest]
#[test(tokio::test)]
async fn should_support_json_removing_file(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_removing_file(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -25,7 +25,7 @@ async fn should_support_json_removing_file(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -41,8 +41,8 @@ async fn should_support_json_removing_file(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_removing_empty_directory(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_removing_empty_directory(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -60,7 +60,7 @@ async fn should_support_json_removing_empty_directory(mut json_repl: CtxCommand<
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -77,9 +77,9 @@ async fn should_support_json_removing_empty_directory(mut json_repl: CtxCommand<
#[rstest]
#[test(tokio::test)]
async fn should_support_json_removing_nonempty_directory_if_force_specified(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -97,7 +97,7 @@ async fn should_support_json_removing_nonempty_directory_if_force_specified(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -113,8 +113,8 @@ async fn should_support_json_removing_nonempty_directory_if_force_specified(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -133,7 +133,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -13,8 +13,8 @@ that is a file's contents
#[rstest]
#[test(tokio::test)]
async fn should_support_json_renaming_file(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_renaming_file(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -33,7 +33,7 @@ async fn should_support_json_renaming_file(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -50,8 +50,8 @@ async fn should_support_json_renaming_file(mut json_repl: CtxCommand<Repl>) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_renaming_nonempty_directory(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_renaming_nonempty_directory(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -74,7 +74,7 @@ async fn should_support_json_renaming_nonempty_directory(mut json_repl: CtxComma
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -94,8 +94,8 @@ async fn should_support_json_renaming_nonempty_directory(mut json_repl: CtxComma
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -112,7 +112,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "error", "JSON: {res}");

@ -6,8 +6,10 @@ use test_log::test;
#[rstest]
#[test(tokio::test)]
async fn should_support_json_search_filesystem_using_query(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_search_filesystem_using_query(
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut api_process).await;
let root = assert_fs::TempDir::new().unwrap();
root.child("file1.txt").write_str("some file text").unwrap();
@ -30,7 +32,7 @@ async fn should_support_json_search_filesystem_using_query(mut json_repl: CtxCom
});
// Submit search request and get back started confirmation
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
// Get id from started confirmation
assert_eq!(res["origin_id"], id, "JSON: {res}");
@ -40,7 +42,7 @@ async fn should_support_json_search_filesystem_using_query(mut json_repl: CtxCom
.expect("id missing or not number");
// Get search results back
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
res["payload"],
@ -74,7 +76,7 @@ async fn should_support_json_search_filesystem_using_query(mut json_repl: CtxCom
);
// Get search completion confirmation
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
res["payload"],

@ -6,8 +6,8 @@ use test_log::test;
#[rstest]
#[test(tokio::test)]
async fn should_support_json_system_info(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_system_info(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let id = rand::random::<u64>().to_string();
let req = json!({
@ -15,7 +15,7 @@ async fn should_support_json_system_info(mut json_repl: CtxCommand<Repl>) {
"payload": { "type": "system_info" },
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(

@ -19,8 +19,8 @@ async fn wait_millis(millis: u64) {
#[rstest]
#[test(tokio::test)]
async fn should_support_json_watching_single_file(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_watching_single_file(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -37,7 +37,7 @@ async fn should_support_json_watching_single_file(mut json_repl: CtxCommand<Repl
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -56,7 +56,7 @@ async fn should_support_json_watching_single_file(mut json_repl: CtxCommand<Repl
// Get the response and verify the change
// NOTE: Don't bother checking the kind as it can vary by platform
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "changed", "JSON: {res}");
@ -69,8 +69,10 @@ async fn should_support_json_watching_single_file(mut json_repl: CtxCommand<Repl
#[rstest]
#[test(tokio::test)]
async fn should_support_json_watching_directory_recursively(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_watching_directory_recursively(
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -91,7 +93,7 @@ async fn should_support_json_watching_directory_recursively(mut json_repl: CtxCo
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(
@ -112,7 +114,7 @@ async fn should_support_json_watching_directory_recursively(mut json_repl: CtxCo
// Get the response and verify the change
// NOTE: Don't bother checking the kind as it can vary by platform
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "changed", "JSON: {res}");
@ -128,7 +130,7 @@ async fn should_support_json_watching_directory_recursively(mut json_repl: CtxCo
// Get the response and verify the change
// NOTE: Don't bother checking the kind as it can vary by platform
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], id, "JSON: {res}");
assert_eq!(res["payload"]["type"], "changed", "JSON: {res}");
@ -142,9 +144,9 @@ async fn should_support_json_watching_directory_recursively(mut json_repl: CtxCo
#[rstest]
#[test(tokio::test)]
async fn should_support_json_reporting_changes_using_correct_request_id(
mut json_repl: CtxCommand<Repl>,
mut api_process: CtxCommand<ApiProcess>,
) {
validate_authentication(&mut json_repl).await;
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
@ -164,7 +166,7 @@ async fn should_support_json_reporting_changes_using_correct_request_id(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id_1, "JSON: {res}");
assert_eq!(
@ -185,7 +187,7 @@ async fn should_support_json_reporting_changes_using_correct_request_id(
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
assert_eq!(res["origin_id"], id_2, "JSON: {res}");
assert_eq!(
@ -204,7 +206,7 @@ async fn should_support_json_reporting_changes_using_correct_request_id(
// Get the response and verify the change
// NOTE: Don't bother checking the kind as it can vary by platform
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], id_1, "JSON: {res}");
assert_eq!(res["payload"]["type"], "changed", "JSON: {res}");
@ -219,7 +221,7 @@ async fn should_support_json_reporting_changes_using_correct_request_id(
// Sleep a bit to give time to get all changes happening
wait_a_bit().await;
if json_repl
if api_process
.try_read_line_from_stdout()
.expect("stdout closed unexpectedly")
.is_none()
@ -236,7 +238,7 @@ async fn should_support_json_reporting_changes_using_correct_request_id(
// Get the response and verify the change
// NOTE: Don't bother checking the kind as it can vary by platform
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
let res = api_process.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(res["origin_id"], id_2, "JSON: {res}");
assert_eq!(res["payload"]["type"], "changed", "JSON: {res}");
@ -249,8 +251,8 @@ async fn should_support_json_reporting_changes_using_correct_request_id(
#[rstest]
#[test(tokio::test)]
async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
validate_authentication(&mut json_repl).await;
async fn should_support_json_output_for_error(mut api_process: CtxCommand<ApiProcess>) {
validate_authentication(&mut api_process).await;
let temp = assert_fs::TempDir::new().unwrap();
let path = temp.to_path_buf().join("missing");
@ -265,7 +267,7 @@ async fn should_support_json_output_for_error(mut json_repl: CtxCommand<Repl>) {
},
});
let res = json_repl.write_and_read_json(req).await.unwrap().unwrap();
let res = api_process.write_and_read_json(req).await.unwrap().unwrap();
// Ensure we got an acknowledgement of watching that failed
assert_eq!(res["origin_id"], id, "JSON: {res}");

@ -13,8 +13,8 @@ use std::{
time::{Duration, Instant},
};
mod repl;
pub use repl::Repl;
mod api;
pub use api::ApiProcess;
static ROOT_LOG_DIR: Lazy<PathBuf> = Lazy::new(|| std::env::temp_dir().join("distant"));
static SESSION_RANDOM: Lazy<u16> = Lazy::new(rand::random);
@ -335,23 +335,21 @@ pub fn action_std_cmd(ctx: DistantManagerCtx) -> CtxCommand<StdCommand> {
}
#[fixture]
pub fn json_repl(ctx: DistantManagerCtx) -> CtxCommand<Repl> {
pub fn api_process(ctx: DistantManagerCtx) -> CtxCommand<ApiProcess> {
let child = ctx
.new_std_cmd(vec!["repl"])
.arg("--format")
.arg("json")
.new_std_cmd(vec!["api"])
.spawn()
.expect("Failed to start distant repl with json format");
let cmd = Repl::new(child, TIMEOUT);
.expect("Failed to start distant api with json format");
let cmd = ApiProcess::new(child, TIMEOUT);
CtxCommand { ctx, cmd }
}
pub async fn validate_authentication(repl: &mut Repl) {
pub async fn validate_authentication(proc: &mut ApiProcess) {
// NOTE: We have to handle receiving authentication messages, as we will get
// an authentication initialization of with method "none", and then
// a finish authentication status before we can do anything else.
let json = repl
let json = proc
.read_json_from_stdout()
.await
.unwrap()
@ -361,7 +359,7 @@ pub async fn validate_authentication(repl: &mut Repl) {
json!({"type": "auth_initialization", "methods": ["none"]})
);
let json = repl
let json = proc
.write_and_read_json(json!({
"type": "auth_initialization_response",
"methods": ["none"]
@ -371,7 +369,7 @@ pub async fn validate_authentication(repl: &mut Repl) {
.expect("Missing authentication method");
assert_eq!(json, json!({"type": "auth_start_method", "method": "none"}));
let json = repl
let json = proc
.read_json_from_stdout()
.await
.unwrap()

@ -9,7 +9,7 @@ use tokio::sync::mpsc;
const CHANNEL_BUFFER: usize = 100;
pub struct Repl {
pub struct ApiProcess {
child: Child,
stdin: mpsc::Sender<String>,
stdout: mpsc::Receiver<String>,
@ -17,8 +17,8 @@ pub struct Repl {
timeout: Option<Duration>,
}
impl Repl {
/// Create a new [`Repl`] wrapping around a [`Child`]
impl ApiProcess {
/// Create a new [`ApiProcess`] wrapping around a [`Child`]
pub fn new(mut child: Child, timeout: impl Into<Option<Duration>>) -> Self {
let mut stdin = BufWriter::new(child.stdin.take().expect("Child missing stdin"));
let mut stdout = BufReader::new(child.stdout.take().expect("Child missing stdout"));
@ -80,7 +80,7 @@ impl Repl {
}
}
/// Writes json to the repl over stdin and then waits for json to be received over stdout,
/// Writes json to the api over stdin and then waits for json to be received over stdout,
/// failing if either operation exceeds timeout if set or if the output to stdout is not json,
/// and returns none if stdout channel has closed
pub async fn write_and_read_json(
@ -200,13 +200,13 @@ impl Repl {
stderr
}
/// Kills the repl by sending a signal to the process
/// Kills the api by sending a signal to the process
pub fn kill(&mut self) -> io::Result<()> {
self.child.kill()
}
}
impl Drop for Repl {
impl Drop for ApiProcess {
fn drop(&mut self) {
let _ = self.kill();
}

@ -1,6 +1,6 @@
mod api;
mod client;
mod fixtures;
mod manager;
mod repl;
mod scripts;
mod utils;

Loading…
Cancel
Save