Skip to content

Commit

Permalink
Test environment initial setup
Browse files Browse the repository at this point in the history
Downloads, installs and starts up Nigiri in the local host.
Assumes that Docker is installed.

Nigiri starts up Docker containers for bitcoind, electrs and esplora in regtest.
The integration tests should be able to connect to them.
  • Loading branch information
namloan committed Nov 27, 2024
1 parent 4c5b4f4 commit 0140186
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
7 changes: 7 additions & 0 deletions adaptor/tests/bisq_musig_integration_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mod common;

#[test]
fn test_bisq_musig() {
common::setup();
assert_eq!(2 + 2, 4);
}
55 changes: 55 additions & 0 deletions adaptor/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
pub fn setup() {
use std::process::Command;

println!("Starting the setup...");

// Step 1: Run the curl command to download and install Nigiri
let curl_output = Command::new("sh")
.arg("-c")
.arg("curl https://getnigiri.vulpem.com | bash")
.output();

match curl_output {
Ok(output) => {
if output.status.success() {
println!("Successfully ran the curl command.");
} else {
eprintln!(
"Failed to run the curl command. Error: {}",
String::from_utf8_lossy(&output.stderr)
);
std::process::exit(1);
}
}
Err(e) => {
eprintln!("Error while running the curl command: {}", e);
std::process::exit(1);
}
}

// Step 2: Run 'nigiri start' to start Nigiri
let nigiri_output = Command::new("nigiri")
.arg("start")
.output();

match nigiri_output {
Ok(output) => {
if output.status.success() {
println!("Nigiri started successfully.");
} else {
eprintln!(
"Failed to start Nigiri. Error: {}",
String::from_utf8_lossy(&output.stderr)
);
std::process::exit(1);
}
}
Err(e) => {
eprintln!("Error while starting Nigiri: {}", e);
std::process::exit(1);
}
}

println!("Setup completed successfully.");
}

0 comments on commit 0140186

Please sign in to comment.