Skip to content

Commit

Permalink
update imports
Browse files Browse the repository at this point in the history
clean up

update cargo
  • Loading branch information
dkijania committed Jul 6, 2020
1 parent 6b23bb2 commit d921da3
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 28 deletions.
@@ -1,12 +1,9 @@
use std::env;
use std::path::PathBuf;

pub use jormungandr_testing_utils::testing::configuration::{Block0ConfigurationBuilder,
JormungandrParams,
TestConfig,
NodeConfigBuilder,
write_secret, SecretModelFactory,
get_available_port,
pub use jormungandr_testing_utils::testing::configuration::{
get_available_port, write_secret, Block0ConfigurationBuilder, JormungandrParams,
NodeConfigBuilder, SecretModelFactory, TestConfig,
};

/// Get jormungandr executable from current environment
Expand Down Expand Up @@ -66,4 +63,4 @@ pub fn get_openapi_path() -> PathBuf {
path.push("api");
path.push("v0.yaml");
path
}
}
@@ -1,7 +1,6 @@
use crate::common::{
configuration::{
self, JormungandrParams, Block0ConfigurationBuilder, NodeConfigBuilder,
SecretModelFactory,
self, Block0ConfigurationBuilder, JormungandrParams, NodeConfigBuilder, SecretModelFactory,
},
jcli_wrapper,
jormungandr::JormungandrProcess,
Expand Down
Expand Up @@ -3,7 +3,7 @@ pub use commands::{get_command, CommandBuilder};

use super::ConfigurationBuilder;
use crate::common::{
configuration::{get_jormungandr_app, JormungandrParams, TestConfig, },
configuration::{get_jormungandr_app, JormungandrParams, TestConfig},
file_utils,
jcli_wrapper::jcli_commands,
jormungandr::{logger::JormungandrLogger, process::JormungandrProcess},
Expand Down
Expand Up @@ -5,10 +5,10 @@ use jormungandr_testing_utils::testing::{

mod rest;

pub use jormungandr_testing_utils::legacy::{version_0_8_19, NodeConfig, Version};
pub use jormungandr_testing_utils::testing::configuration::{
LegacyConfigConverter, LegacyConfigConverterError, LegacyNodeConfigConverter,
};
pub use jormungandr_testing_utils::legacy::{NodeConfig, Version,version_0_8_19};
pub use rest::BackwardCompatibleRest;

use crate::common::file_utils;
Expand Down
2 changes: 1 addition & 1 deletion testing/jormungandr-integration-tests/src/common/mod.rs
Expand Up @@ -2,6 +2,7 @@

extern crate serde_derive;

pub mod configuration;
pub mod data;
pub mod explorer;
pub mod file_utils;
Expand All @@ -15,4 +16,3 @@ pub mod process_assert;
pub mod process_utils;
pub mod startup;
pub mod transaction_utils;
pub mod configuration;
@@ -1,5 +1,5 @@
use crate::common::{
configuration::{JormungandrParams, Block0ConfigurationBuilder},
configuration::{Block0ConfigurationBuilder, JormungandrParams},
jcli_wrapper,
jormungandr::ConfigurationBuilder,
startup,
Expand Down
4 changes: 4 additions & 0 deletions testing/jormungandr-testing-utils/Cargo.toml
Expand Up @@ -34,6 +34,10 @@ zip = "0.5.6"
flate2 = "1.0.16"
tar = "0.4"
hex = "0.4"
lazy_static = "1"
serde_derive = "1.0"
assert_fs = "1.0"
serde_yaml = "0.8"
tokio-codec = "0.1"
futures = "0.1"
assert_fs = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion testing/jormungandr-testing-utils/src/legacy/mod.rs
Expand Up @@ -5,4 +5,4 @@ pub use config::{
Explorer, Log, Mempool, NodeConfig, P2p, Policy, Rest, TopicsOfInterest, TrustedPeer,
};

pub use version::Version;
pub use version::{version_0_8_19, Version};
4 changes: 4 additions & 0 deletions testing/jormungandr-testing-utils/src/legacy/version.rs
@@ -1,5 +1,9 @@
use std::{cmp::Ordering, fmt, num::ParseIntError, str::FromStr};

pub const fn version_0_8_19() -> Version {
Version::new(0, 8, 19)
}

#[derive(Eq, Debug, Copy, Clone)]
pub struct Version {
major: u32,
Expand Down
2 changes: 2 additions & 0 deletions testing/jormungandr-testing-utils/src/lib.rs
Expand Up @@ -2,3 +2,5 @@ pub mod legacy;
pub mod stake_pool;
pub mod testing;
pub mod wallet;

pub use legacy::{version_0_8_19, Version};
@@ -1,10 +1,10 @@
#![allow(dead_code)]

use super::TestConfig;
use crate::wallet::Wallet;
use chain_core::mempack;
use chain_impl_mockchain::{block::Block, fee::LinearFee, fragment::Fragment};
use jormungandr_lib::interfaces::{Block0Configuration, NodeConfig, UTxOInfo};
use jormungandr_testing_utils::wallet::Wallet;

use serde::Serialize;
use std::fs::File;
Expand All @@ -24,7 +24,7 @@ pub struct JormungandrParams<Conf = NodeConfig> {
}

impl<Conf: TestConfig> JormungandrParams<Conf> {
pub(crate) fn new<Secs>(
pub fn new<Secs>(
node_config: Conf,
node_config_path: impl Into<PathBuf>,
genesis_block_path: impl Into<PathBuf>,
Expand Down
@@ -1,21 +1,18 @@
use super::Version;
use crate::common::configuration::JormungandrParams;
use jormungandr_lib::interfaces::NodeConfig as NewestNodeConfig;
use jormungandr_testing_utils::legacy::{NodeConfig, P2p, Rest, TrustedPeer};
use crate::version_0_8_19;
use crate::{
legacy::{NodeConfig, P2p, TrustedPeer, Version},
testing::JormungandrParams,
};
use jormungandr_lib::interfaces::{NodeConfig as NewestNodeConfig, Rest};
use rand::RngCore;
use rand_core::OsRng;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum LegacyConfigConverterError {
#[error("unsupported version")]
UnsupportedVersion(Version),
}

pub const fn version_0_8_19() -> Version {
Version::new(0, 8, 19)
}

/// Used to build configuration for legacy nodes.
/// It uses yaml_rust instead of serde yaml serializer
/// beacuse config model is always up to date with newest config schema
Expand Down
@@ -0,0 +1,6 @@
mod configuration_builder;
mod node;

pub use configuration_builder::{
LegacyConfigConverter, LegacyConfigConverterError, LegacyNodeConfigConverter,
};
@@ -1,6 +1,4 @@
use crate::common::configuration::TestConfig;
use jormungandr_testing_utils::legacy::NodeConfig;

use crate::{legacy::NodeConfig, testing::TestConfig};
use std::net::SocketAddr;
use std::path::Path;

Expand Down
32 changes: 32 additions & 0 deletions testing/jormungandr-testing-utils/src/testing/configuration/mod.rs
@@ -0,0 +1,32 @@
extern crate lazy_static;
extern crate rand;

use self::lazy_static::lazy_static;
use self::rand::Rng;
use std::path::PathBuf;
use std::sync::atomic::{AtomicU16, Ordering};

mod block0_config_builder;
mod jormungandr_config;
mod legacy;
mod node_config;
mod node_config_builder;
mod secret_model_factory;

pub use block0_config_builder::Block0ConfigurationBuilder;
pub use jormungandr_config::JormungandrParams;
pub use legacy::{LegacyConfigConverter, LegacyConfigConverterError, LegacyNodeConfigConverter};
pub use node_config::TestConfig;
pub use node_config_builder::NodeConfigBuilder;
pub use secret_model_factory::{write_secret, SecretModelFactory};

lazy_static! {
static ref NEXT_AVAILABLE_PORT_NUMBER: AtomicU16 = {
let initial_port = rand::thread_rng().gen_range(6000, 10999);
AtomicU16::new(initial_port)
};
}

pub fn get_available_port() -> u16 {
NEXT_AVAILABLE_PORT_NUMBER.fetch_add(1, Ordering::SeqCst)
}
6 changes: 6 additions & 0 deletions testing/jormungandr-testing-utils/src/testing/mod.rs
@@ -1,4 +1,5 @@
mod archive;
pub mod configuration;
mod fragments;
pub mod github;
/// Module contains cross project test utils
Expand Down Expand Up @@ -31,4 +32,9 @@ pub use web::download_file;

pub use verify::{assert, assert_equals, Error as VerificationError};

pub use configuration::{
Block0ConfigurationBuilder, JormungandrParams, LegacyConfigConverter,
LegacyConfigConverterError, LegacyNodeConfigConverter, NodeConfigBuilder, SecretModelFactory,
TestConfig,
};
pub use openssl::Openssl;

0 comments on commit d921da3

Please sign in to comment.