From a4f120c8f744374aa51701dfd96407aa272642b5 Mon Sep 17 00:00:00 2001 From: Parth Desai Date: Tue, 23 Jan 2024 10:43:45 +0400 Subject: [PATCH] transfer tests to root in order for them to run --- .github/workflows/ci-tests.yml | 4 ++-- Cargo.lock | 5 +++++ Cargo.toml | 13 +++++++++++++ {sdk/examples => examples}/complete.rs | 0 {sdk/examples => examples}/mini-farmer.rs | 0 {sdk/examples => examples}/simple.rs | 0 {sdk/examples => examples}/sync.rs | 0 sdk/src/lib.rs | 5 +++++ {sdk/tests => tests}/integration/common.rs | 7 ++++--- {sdk/tests => tests}/integration/domains.rs | 0 {sdk/tests => tests}/integration/farmer.rs | 2 +- {sdk/tests => tests}/integration/main.rs | 0 {sdk/tests => tests}/integration/node.rs | 2 +- 13 files changed, 31 insertions(+), 7 deletions(-) rename {sdk/examples => examples}/complete.rs (100%) rename {sdk/examples => examples}/mini-farmer.rs (100%) rename {sdk/examples => examples}/simple.rs (100%) rename {sdk/examples => examples}/sync.rs (100%) rename {sdk/tests => tests}/integration/common.rs (97%) rename {sdk/tests => tests}/integration/domains.rs (100%) rename {sdk/tests => tests}/integration/farmer.rs (99%) rename {sdk/tests => tests}/integration/main.rs (100%) rename {sdk/tests => tests}/integration/node.rs (99%) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index ed5e4ba0..fad239f0 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -174,11 +174,11 @@ jobs: run: cargo cache - name: Build and run tests (linux & windows) - run: cd sdk && cargo test --locked --release -- --test-threads=1 --nocapture && cd .. && cargo test --locked --release -- --test-threads=1 --nocapture + run: cargo test --locked --release -- --test-threads=1 --nocapture if: runner.os != 'macOS' - name: Build and run tests (macOS) - run: cd sdk && cargo test --locked --release --no-default-features -- --test-threads=1 --nocapture && cd .. && cargo test --locked --release --no-default-features -- --test-threads=1 --nocapture + run: cargo test --locked --release --no-default-features -- --test-threads=1 --nocapture if: runner.os == 'macOS' - name: Clean unused artifacts diff --git a/Cargo.lock b/Cargo.lock index 0e4b5f0c..2a81f3fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8294,6 +8294,7 @@ dependencies = [ "console-subscriber", "crossterm", "derivative", + "derive_builder 0.12.0", "derive_more", "dirs", "fdlimit 0.2.1", @@ -8308,11 +8309,14 @@ dependencies = [ "rand 0.8.5", "serde", "serde_derive", + "serde_json", "single-instance", "sp-core", "strum", "strum_macros 0.24.3", + "subspace-farmer-components", "subspace-sdk", + "tempfile", "thiserror", "tokio", "toml 0.7.8", @@ -8320,6 +8324,7 @@ dependencies = [ "tracing-appender", "tracing-bunyan-formatter", "tracing-error", + "tracing-futures", "tracing-subscriber 0.3.18", "whoami", "zeroize", diff --git a/Cargo.toml b/Cargo.toml index b3e69d36..1ac7f0a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,19 @@ zeroize = "1.6.0" [dev-dependencies] rand = "0.8.5" +anyhow = "1" +clap = { version = "4", features = ["derive"] } +derive_builder = "0.12" +derive_more = "0.99" +fdlimit = "0.2" +futures = "0.3" +serde_json = "1" +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "bd435100200b3dcce6d6f50534d52e3cd039ca8e" } +tempfile = "3" +tokio = { version = "1.34.0", features = ["rt-multi-thread", "macros"] } +tracing = "0.1" +tracing-futures = "0.2" +tracing-subscriber = "0.3" [features] default = [ diff --git a/sdk/examples/complete.rs b/examples/complete.rs similarity index 100% rename from sdk/examples/complete.rs rename to examples/complete.rs diff --git a/sdk/examples/mini-farmer.rs b/examples/mini-farmer.rs similarity index 100% rename from sdk/examples/mini-farmer.rs rename to examples/mini-farmer.rs diff --git a/sdk/examples/simple.rs b/examples/simple.rs similarity index 100% rename from sdk/examples/simple.rs rename to examples/simple.rs diff --git a/sdk/examples/sync.rs b/examples/sync.rs similarity index 100% rename from sdk/examples/sync.rs rename to examples/sync.rs diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 843a53bc..55a915ac 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -45,3 +45,8 @@ pub mod node { pub use super::Node; } + +/// SDK utilities, mainly used by tests +pub mod utils { + pub use sdk_utils::*; +} diff --git a/sdk/tests/integration/common.rs b/tests/integration/common.rs similarity index 97% rename from sdk/tests/integration/common.rs rename to tests/integration/common.rs index 44e08dab..72c48a69 100644 --- a/sdk/tests/integration/common.rs +++ b/tests/integration/common.rs @@ -4,10 +4,11 @@ use std::sync::Arc; use derive_builder::Builder; use derive_more::{Deref, DerefMut}; -use sdk_node::DomainConfigBuilder; -use sdk_utils::ByteSize; use subspace_sdk::farmer::FarmDescription; -use subspace_sdk::node::{chain_spec, ChainSpec, DsnBuilder, NetworkBuilder, Role}; +use subspace_sdk::node::{ + chain_spec, ChainSpec, DomainConfigBuilder, DsnBuilder, NetworkBuilder, Role, +}; +use subspace_sdk::utils::ByteSize; use subspace_sdk::MultiaddrWithPeerId; use tempfile::TempDir; use tracing_subscriber::layer::SubscriberExt; diff --git a/sdk/tests/integration/domains.rs b/tests/integration/domains.rs similarity index 100% rename from sdk/tests/integration/domains.rs rename to tests/integration/domains.rs diff --git a/sdk/tests/integration/farmer.rs b/tests/integration/farmer.rs similarity index 99% rename from sdk/tests/integration/farmer.rs rename to tests/integration/farmer.rs index ba359805..e7ed6083 100644 --- a/sdk/tests/integration/farmer.rs +++ b/tests/integration/farmer.rs @@ -1,5 +1,5 @@ use futures::prelude::*; -use sdk_utils::ByteSize; +use subspace_sdk::utils::ByteSize; use crate::common::{Farmer, Node}; diff --git a/sdk/tests/integration/main.rs b/tests/integration/main.rs similarity index 100% rename from sdk/tests/integration/main.rs rename to tests/integration/main.rs diff --git a/sdk/tests/integration/node.rs b/tests/integration/node.rs similarity index 99% rename from sdk/tests/integration/node.rs rename to tests/integration/node.rs index d6233a26..179ea016 100644 --- a/sdk/tests/integration/node.rs +++ b/tests/integration/node.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use futures::prelude::*; -use sdk_utils::ByteSize; +use subspace_sdk::utils::ByteSize; use tempfile::TempDir; use tracing_futures::Instrument;