move cargo_bin_dir() to integration_tests crate as is it used only there

This commit is contained in:
Stas Kelvich
2021-05-18 15:42:56 +03:00
parent d59cb2ca7a
commit c12e393e74
2 changed files with 13 additions and 14 deletions

View File

@@ -164,15 +164,3 @@ pub fn save_config(conf: &LocalEnv) -> Result<()> {
fs::write(config_path, conf_str)?;
Ok(())
}
// Find the directory where the binaries were put (i.e. target/debug/)
pub fn cargo_bin_dir() -> PathBuf {
let mut pathbuf = std::env::current_exe().unwrap();
pathbuf.pop();
if pathbuf.ends_with("deps") {
pathbuf.pop();
}
pathbuf
}

View File

@@ -14,10 +14,21 @@ use nix::unistd::Pid;
use postgres;
use control_plane::compute::PostgresNode;
use control_plane::local_env;
use control_plane::read_pidfile;
use control_plane::{local_env::LocalEnv, storage::PageServerNode};
// Find the directory where the binaries were put (i.e. target/debug/)
fn cargo_bin_dir() -> PathBuf {
let mut pathbuf = std::env::current_exe().unwrap();
pathbuf.pop();
if pathbuf.ends_with("deps") {
pathbuf.pop();
}
pathbuf
}
// local compute env for tests
pub fn create_test_env(testname: &str) -> LocalEnv {
let base_path = Path::new(env!("CARGO_MANIFEST_DIR"))
@@ -39,7 +50,7 @@ pub fn create_test_env(testname: &str) -> LocalEnv {
LocalEnv {
pageserver_connstring: "postgresql://127.0.0.1:64000".to_string(),
pg_distrib_dir: Path::new(env!("CARGO_MANIFEST_DIR")).join("../tmp_install"),
zenith_distrib_dir: Some(local_env::cargo_bin_dir()),
zenith_distrib_dir: Some(cargo_bin_dir()),
base_data_dir: base_path,
remotes: BTreeMap::default(),
}