diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 004a3c71..a1156380 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -106,8 +106,11 @@ jobs: MAIN_VAULT_ADDRESS: ${{ secrets.MAIN_VAULT_ADDRESS }} RUST_BACKTRACE: 1 + - name: RGB Test Init + run: cargo test --locked --features server --test init -- init --nocapture --test-threads 1 + - name: RGB Tests - run: cargo test --locked --features server --test rgb -- rgb --nocapture --test-threads 1 + run: cargo test --locked --features server --test rgb -- rgb --nocapture --test-threads 1 env: TEST_WALLET_SEED: ${{ secrets.TEST_WALLET_SEED }} RUST_BACKTRACE: 1 diff --git a/src/regtest.rs b/src/regtest.rs index 4edbdcd8..d5d390f3 100644 --- a/src/regtest.rs +++ b/src/regtest.rs @@ -1,6 +1,19 @@ #![cfg(not(target_arch = "wasm32"))] -use std::env; -use std::process::{Command, Stdio}; +use std::{ + env, path, + process::{Command, Stdio}, +}; + +use anyhow::Result; +use tokio::fs; + +pub async fn init_fs() -> Result<()> { + let dir = env::var("CARBONADO_DIR").unwrap_or("/tmp/bitmaskd/carbonado".to_owned()); + let dir = path::Path::new(&dir); + fs::create_dir_all(dir).await?; + + Ok(()) +} pub fn send_coins(address: &str, amount: &str) { let path = env::current_dir().expect("oh no!"); diff --git a/tests/init.rs b/tests/init.rs new file mode 100644 index 00000000..035b7bc6 --- /dev/null +++ b/tests/init.rs @@ -0,0 +1,11 @@ +#![cfg(not(target_arch = "wasm32"))] + +use anyhow::Result; +use bitmask_core::regtest::init_fs; + +#[tokio::test] +pub async fn init() -> Result<()> { + init_fs().await?; + + Ok(()) +}