Skip to content

Commit

Permalink
Ensure test runner uses test 'fluvio' for cluster setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholastmosher committed Apr 12, 2021
1 parent 7b3e606 commit ce21dcb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cluster/src/start/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,7 @@ impl LocalInstaller {
binary
.stdout(Stdio::from(outputs))
.stderr(Stdio::from(errors))
.inherit()
.log()
.print()
.spawn()?;

Ok((LOCAL_SC_ADDRESS.to_owned(), LOCAL_SC_PORT))
Expand Down Expand Up @@ -638,8 +637,7 @@ impl LocalInstaller {
info!("SPU log generated at {}", log_spu);
cmd.stdout(Stdio::from(outputs))
.stderr(Stdio::from(errors))
.inherit()
.log()
.print()
.spawn()
.map_err(|_| LocalInstallError::Other("SPU server failed to start".to_string()))?;
Ok(())
Expand Down
18 changes: 18 additions & 0 deletions src/command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ pub trait CommandExt {
/// .spawn();
/// ```
fn log(&mut self) -> &mut Self;
/// Print a stringified version of the Command to stdout.
///
/// # Example
///
/// ```
/// use std::process::Command;
/// use fluvio_command::CommandExt;
/// let _ = Command::new("echo")
/// .arg("How are you Fluvio")
/// .print()
/// .spawn();
/// ```
fn print(&mut self) -> &mut Self;
/// Return a stringified version of the Command.
///
/// # Example
Expand Down Expand Up @@ -135,6 +148,11 @@ impl CommandExt for Command {
self
}

fn print(&mut self) -> &mut Self {
println!("Command> {:?}", self.display());
self
}

fn display(&self) -> String {
format!("{:?}", self).replace("\"", "")
}
Expand Down
9 changes: 9 additions & 0 deletions tests/runner/src/utils/setup/environment/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ impl TestEnvironmentDriver for LocalEnvDriver {
let mut builder = LocalConfig::builder(crate::VERSION);
builder.spu_replicas(self.option.spu()).render_checks(true);

// Make sure to use the test build of 'fluvio' for cluster components
let test_exe = std::env::current_exe();
let build_dir = test_exe
.ok()
.and_then(|it| it.parent().map(|it| it.join("fluvio")));
if let Some(path) = build_dir {
builder.launcher(path);
}

if let Some(rust_log) = &self.option.server_log() {
builder.rust_log(rust_log);
}
Expand Down

0 comments on commit ce21dcb

Please sign in to comment.