Skip to content

Commit

Permalink
Add init function for integration tests. Can init other things too.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoquick committed Dec 18, 2023
1 parent 3749290 commit ddf4138
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions src/regtest.rs
Original file line number Diff line number Diff line change
@@ -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!");
Expand Down
11 changes: 11 additions & 0 deletions tests/init.rs
Original file line number Diff line number Diff line change
@@ -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(())
}

0 comments on commit ddf4138

Please sign in to comment.