Skip to content

Commit

Permalink
Refactor config.toml locations
Browse files Browse the repository at this point in the history
  • Loading branch information
xevisalle committed Nov 22, 2023
1 parent 1d9eeb6 commit d60d494
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 77 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

## Testing the environment

You can test if the environment you set up and the library are working properly by specifying the testing Rusk node address in `integration-tests/tests/config/config.toml`, and executing the following (note that the wallet needs to use `password` as password for the tests to succeed):
You can test if the environment you set up and the library are working properly by specifying the testing Rusk node address in `integration-tests/config.toml`, and executing the following (note that the wallet needs to use `password` as password for the tests to succeed):

```
cargo t --release --features="exp_tests" -- --test-threads=1
Expand All @@ -25,7 +25,7 @@ The `moat-cli` utility can be used from the POV of any of the parties involved i
- **License Provider (LP):** A party receiving onchain requests from users to issue licenses onchain addressed to them.
- **Service Provider (SP):** A party receiving offchain requests from users to grant services.

To use the CLI, you should specify the Rusk node address in `config.toml`. Then, you can execute the CLI for any of the involved parties as follows.
To use the CLI, you should specify the Rusk node address in `moat-cli/config.toml`. Then, you can execute the CLI for any of the involved parties as follows.

### User

Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions integration-tests/tests/blockchain/get_crs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const MIN_CRS_SIZE: usize = 10 * 1024 * 1024;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn get_crs() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand Down
12 changes: 4 additions & 8 deletions integration-tests/tests/blockchain/retrieve_txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use tracing::trace;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn retrieve_txs_from_block() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -32,8 +31,7 @@ async fn retrieve_txs_from_block() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn retrieve_txs_from_block_range() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -58,8 +56,7 @@ async fn retrieve_txs_from_block_range() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn retrieve_txs_from_last_n_blocks() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -79,8 +76,7 @@ async fn retrieve_tx_by_id() -> Result<(), Error> {
const TXID: &str =
"44fe2c6407fc400a2dee6e30c62a02b82f3980da18d3b6306e80f9f83730520d";

let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let config = BlockchainAccessConfig::load_path(config_path)?;

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/blockchain/stake_add_owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub const ADD_OWNER_METHOD_NAME: &str = "add_owner";
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn stake_add_owner() -> Result<(), Error> {
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let blockchain_config =
BlockchainAccessConfig::load_path(blockchain_config_path)?;
Expand Down
14 changes: 7 additions & 7 deletions integration-tests/tests/citadel/int_test_lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use toml_base_config::BaseConfig;
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn lp_scan() -> Result<(), Error> {
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let lp_config_path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/config/test_keys_lp.json"
"/tests/test_keys/test_keys_lp.json"
);

let blockchain_config =
Expand All @@ -32,10 +32,10 @@ async fn lp_scan() -> Result<(), Error> {
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn lp_scan_last_blocks() -> Result<(), Error> {
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let lp_config_path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/config/test_keys_lp_2.json"
"/tests/test_keys/test_keys_lp_2.json"
);

let blockchain_config =
Expand All @@ -53,14 +53,14 @@ async fn lp_scan_last_blocks() -> Result<(), Error> {
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn lp_scan_2_lps() -> Result<(), Error> {
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let lp1_config_path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/config/test_keys_lp.json"
"/tests/test_keys/test_keys_lp.json"
);
let lp2_config_path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/config/test_keys_lp_2.json"
"/tests/test_keys/test_keys_lp_2.json"
);

let blockchain_config =
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/citadel/int_test_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async fn user_round_trip() -> Result<(), Error> {
let mut rng = StdRng::seed_from_u64(0xbeef);

let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let blockchain_config =
BlockchainAccessConfig::load_path(blockchain_config_path)?;
Expand All @@ -153,7 +153,7 @@ async fn user_round_trip() -> Result<(), Error> {

let lp_config_path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/config/test_keys_lp_2.json"
"/tests/test_keys/test_keys_lp_2.json"
);

let reference_lp = ReferenceLP::create(&lp_config_path)?;
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/citadel/issue_license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ async fn issue_license() -> Result<(), Error> {
"/tests/request/test_request.json"
);
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let lp_config_path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/config/test_keys_lp_2.json"
"/tests/test_keys/test_keys_lp_2.json"
);

let reference_lp = ReferenceLP::create(&lp_config_path)?;
Expand Down
12 changes: 4 additions & 8 deletions integration-tests/tests/citadel/license_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use tracing::trace;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_licenses() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -33,8 +32,7 @@ async fn call_get_licenses() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_merkle_opening() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -49,8 +47,7 @@ async fn call_get_merkle_opening() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_session() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -69,8 +66,7 @@ async fn call_get_session() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_info() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand Down
12 changes: 4 additions & 8 deletions integration-tests/tests/citadel/retrieve_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ async fn retrieve_payload() -> Result<(), Error> {
const TXID: &str =
"8d45a9fb7196f322282d522ff4bb2d2e926ddd96b858b91d59f228b27250ef03";

let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let config = BlockchainAccessConfig::load_path(config_path)?;
let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -32,8 +31,7 @@ async fn retrieve_payload() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn scan_all_requests() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");
let cfg = BlockchainAccessConfig::load_path(config_path)?;
let mut height = 0;
loop {
Expand All @@ -58,8 +56,7 @@ async fn scan_all_requests() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn scan_requests_in_last_blocks() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -77,8 +74,7 @@ async fn scan_requests_in_last_blocks() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn scan_requests_in_block_range() -> Result<(), Error> {
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand Down
3 changes: 1 addition & 2 deletions integration-tests/tests/citadel/send_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ async fn send_request() -> Result<(), Error> {
env!("CARGO_MANIFEST_DIR"),
"/tests/request/test_request.json"
);
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config_path = concat!(env!("CARGO_MANIFEST_DIR"), "/config.toml");

let request_json: RequestJson = RequestJson::from_file(request_path)?;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion moat-cli/moat-cli-lp/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Args {
pub wallet_path: PathBuf,

/// Blockchain access config directory
#[clap(short, long, default_value = "./config.toml")]
#[clap(short, long, default_value = "moat-cli/config.toml")]
pub config_path: PathBuf,

/// Password for the wallet
Expand Down
2 changes: 1 addition & 1 deletion moat-cli/moat-cli-sp/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Args {
pub wallet_path: PathBuf,

/// Blockchain access config directory
#[clap(short, long, default_value = "./config.toml")]
#[clap(short, long, default_value = "moat-cli/config.toml")]
pub config_path: PathBuf,

/// Password for the wallet
Expand Down
2 changes: 1 addition & 1 deletion moat-cli/moat-cli-user/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Args {
pub wallet_path: PathBuf,

/// Blockchain access config directory
#[clap(short, long, default_value = "./config.toml")]
#[clap(short, long, default_value = "moat-cli/config.toml")]
pub config_path: PathBuf,

/// Password for the wallet
Expand Down
Loading

0 comments on commit d60d494

Please sign in to comment.