mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-12-01 19:33:56 +01:00
use local chain_type and global chain_type as necessary
This commit is contained in:
+11
-1
@@ -131,7 +131,17 @@ pub fn clean_output_dir(test_dir: &str) {
|
||||
pub fn setup(test_dir: &str) {
|
||||
util::init_test_logger();
|
||||
clean_output_dir(test_dir);
|
||||
global::set_mining_mode(ChainTypes::AutomatedTesting);
|
||||
global::set_local_chain_type(global::ChainTypes::AutomatedTesting);
|
||||
}
|
||||
|
||||
/// Some tests require the global chain_type to be configured.
|
||||
/// If tokio is used in any tests we need to ensure any threads spawned
|
||||
/// have the chain_type configured correctly.
|
||||
/// It is recommended to avoid relying on this if at all possible as global chain_type
|
||||
/// leaks across multiple tests and will likely have unintended consequences.
|
||||
#[allow(dead_code)]
|
||||
pub fn setup_global_chain_type() {
|
||||
global::init_global_chain_type(global::ChainTypes::AutomatedTesting);
|
||||
}
|
||||
|
||||
/// Create a wallet config file in the given current directory
|
||||
|
||||
@@ -36,11 +36,13 @@ use serde_json;
|
||||
mod common;
|
||||
use common::{
|
||||
clean_output_dir, derive_ecdh_key, execute_command, initial_setup_wallet, instantiate_wallet,
|
||||
send_request, send_request_enc, setup, RetrieveSummaryInfoResp,
|
||||
send_request, send_request_enc, setup, setup_global_chain_type, RetrieveSummaryInfoResp,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn owner_v3_init_secure() -> Result<(), grin_wallet_controller::Error> {
|
||||
setup_global_chain_type();
|
||||
|
||||
let test_dir = "target/test_output/owner_v3_init_secure";
|
||||
setup(test_dir);
|
||||
|
||||
|
||||
@@ -40,11 +40,13 @@ mod common;
|
||||
use common::{
|
||||
clean_output_dir, derive_ecdh_key, execute_command, execute_command_no_setup,
|
||||
initial_setup_wallet, instantiate_wallet, send_request, send_request_enc, setup,
|
||||
RetrieveSummaryInfoResp,
|
||||
setup_global_chain_type, RetrieveSummaryInfoResp,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn owner_v3_lifecycle() -> Result<(), grin_wallet_controller::Error> {
|
||||
setup_global_chain_type();
|
||||
|
||||
let test_dir = "target/test_output/owner_v3_lifecycle";
|
||||
setup(test_dir);
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ extern crate log;
|
||||
extern crate grin_wallet;
|
||||
|
||||
use grin_wallet_impls::test_framework::{self, LocalWalletClient, WalletProxy};
|
||||
use grin_wallet_util::grin_core::global::{self, ChainTypes};
|
||||
|
||||
use clap::App;
|
||||
use std::thread;
|
||||
@@ -33,14 +32,14 @@ use grin_wallet_util::grin_util as util;
|
||||
|
||||
#[macro_use]
|
||||
mod common;
|
||||
use common::{execute_command, initial_setup_wallet, instantiate_wallet};
|
||||
use common::{execute_command, initial_setup_wallet, instantiate_wallet, setup_global_chain_type};
|
||||
|
||||
// Development testing helper for tor/socks investigation.
|
||||
// Not (yet) to be run as part of automated testing
|
||||
|
||||
fn setup_no_clean() {
|
||||
util::init_test_logger();
|
||||
global::set_mining_mode(ChainTypes::AutomatedTesting);
|
||||
setup_global_chain_type();
|
||||
}
|
||||
|
||||
#[ignore]
|
||||
|
||||
Reference in New Issue
Block a user