Skip to content

Commit

Permalink
use target dir for integration tests TP..
Browse files Browse the repository at this point in the history
using /tmp is leading to undeterministic behavior on Github CI
  • Loading branch information
plebhash committed Jan 9, 2025
1 parent a053dc7 commit 24a36f1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions roles/tests-integration/lib/template_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ pub struct TemplateProvider {

impl TemplateProvider {
pub fn start(port: u16, sv2_interval: u32) -> Self {
let temp_dir = PathBuf::from("/tmp/.template-provider");
// get the Cargo target directory from env or default to local "target"
let cargo_target_dir = PathBuf::from(
env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_string())
);

let mut conf = Conf::default();
let staticdir = format!(".bitcoin-{}", port);
conf.staticdir = Some(temp_dir.join(staticdir));
conf.staticdir = Some(cargo_target_dir.join(staticdir));
let port_arg = format!("-sv2port={}", port);
let sv2_interval_arg = format!("-sv2interval={}", sv2_interval);
conf.args.extend(vec![
Expand All @@ -88,7 +92,7 @@ impl TemplateProvider {
let os = env::consts::OS;
let arch = env::consts::ARCH;
let download_filename = get_bitcoind_filename(os, arch);
let bitcoin_exe_home = temp_dir
let bitcoin_exe_home = cargo_target_dir
.join(format!("bitcoin-sv2-tp-{}", VERSION_TP))
.join("bin");

Expand All @@ -112,7 +116,7 @@ impl TemplateProvider {
create_dir_all(parent).unwrap();
}

unpack_tarball(&tarball_bytes, &temp_dir);
unpack_tarball(&tarball_bytes, &cargo_target_dir);

if os == "macos" {
let bitcoind_binary = bitcoin_exe_home.join("bitcoind");
Expand Down

0 comments on commit 24a36f1

Please sign in to comment.