Skip to content

Commit

Permalink
Rename testing to test-exports and clear when both used for no reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT committed Oct 23, 2023
1 parent 84ee881 commit 96e4af1
Show file tree
Hide file tree
Showing 72 changed files with 158 additions and 156 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ opt-level = 3 # Speed-up the CI

# # Features
#
# * testing: enable some tests specific exports.
# Usage: add testing = ["massa_crate/testing", ...] to dev-dependencies to use test specific functions avaible in massa-crate.
# * test-exports: enable some tests specific exports.
# Usage: add test-exports = ["massa_crate/test-exports", ...] to dev-dependencies to use test specific functions avaible in massa-crate.
# Do not add as a regular dependency. Never.
#
# * sandbox: for testing purpose, genesis timestamps is set as now + 9 seconds.
Expand Down
2 changes: 1 addition & 1 deletion massa-api-exports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[features]
sandbox = []
testing = []
test-exports = []

[dependencies]
paginate = {workspace = true}
Expand Down
4 changes: 2 additions & 2 deletions massa-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.26.1"
edition = "2021"

[features]
testing = []
test-exports = []

[dependencies]
jsonrpsee = { workspace = true, "features" = ["server", "macros"] }
Expand Down Expand Up @@ -37,7 +37,7 @@ massa_wallet = { workspace = true }


[dev-dependencies]
massa_consensus_exports = { workspace = true, "features" = ["testing"] }
massa_consensus_exports = { workspace = true, "features" = ["test-exports"] }
tempfile = { workspace = true }
num = { workspace = true }
massa_final_state = { workspace = true }
2 changes: 1 addition & 1 deletion massa-async-pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Massa Labs <info@massa.net>"]
edition = "2021"

[features]
testing = []
test-exports = []
sandbox = []

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions massa-async-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
//!
//! ## Test exports
//!
//! When the crate feature `testing` is enabled, tooling useful for testing purposes is exported.
//! When the crate feature `test-exports` is enabled, tooling useful for test-exports purposes is exported.
//! See `test_exports/mod.rs` for details.

mod changes;
Expand All @@ -103,5 +103,5 @@ pub use pool::{AsyncPool, AsyncPoolDeserializer, AsyncPoolSerializer};
#[cfg(test)]
mod tests;

#[cfg(feature = "testing")]
#[cfg(feature = "test-exports")]
pub mod test_exports;
14 changes: 7 additions & 7 deletions massa-bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Massa Labs <info@massa.net>"]
edition = "2021"

[features]
testing = ["massa_final_state/testing", "massa_ledger_worker/testing", "massa_consensus_exports/testing", "massa_async_pool/testing"]
test-exports = ["massa_final_state/test-exports", "massa_ledger_worker/test-exports", "massa_consensus_exports/test-exports", "massa_async_pool/test-exports"]
sandbox = ["massa_async_pool/sandbox", "massa_final_state/sandbox", "massa_models/sandbox"]

[dependencies]
Expand Down Expand Up @@ -46,12 +46,12 @@ lazy_static = {workspace = true} # BOM UPGRADE Revert to "1.4" if problem
tempfile = {workspace = true} # BOM UPGRADE Revert to "3.3" if problem
serial_test = {workspace = true} # BOM UPGRADE Revert to "2.0.0" if problem
num = {workspace = true}
massa_final_state = {workspace = true, "features" = ["testing"]}
massa_async_pool = {workspace = true, "features" = ["testing"]}
massa_final_state = {workspace = true, "features" = ["test-exports"]}
massa_async_pool = {workspace = true, "features" = ["test-exports"]}
massa_ledger_exports = {workspace = true}
massa_ledger_worker = {workspace = true, "features" = ["testing"]}
massa_ledger_worker = {workspace = true, "features" = ["test-exports"]}
massa_executed_ops = {workspace = true}
massa_pos_worker = {workspace = true, "features" = ["testing"]}
massa_pos_exports = {workspace = true, "features" = ["testing"]}
massa_consensus_exports = {workspace = true, "features" = ["testing"]}
massa_pos_worker = {workspace = true, "features" = ["test-exports"]}
massa_pos_exports = {workspace = true, "features" = ["test-exports"]}
massa_consensus_exports = {workspace = true, "features" = ["test-exports"]}
massa_db_worker = {workspace = true}
2 changes: 1 addition & 1 deletion massa-consensus-exports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Massa Labs <info@massa.net>"]
edition = "2021"

[features]
testing = ["massa_models/testing", "massa_execution_exports/testing", "massa_pool_exports/testing", "massa_pos_exports/testing", "massa_protocol_exports/testing", "massa_storage/testing", "dep:mockall"]
test-exports = ["massa_models/test-exports", "massa_execution_exports/test-exports", "massa_pool_exports/test-exports", "massa_pos_exports/test-exports", "massa_protocol_exports/test-exports", "massa_storage/test-exports", "dep:mockall"]

[dependencies]
displaydoc = {workspace = true}
Expand Down
2 changes: 1 addition & 1 deletion massa-consensus-exports/src/controller_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use massa_models::{
use massa_storage::Storage;

/// Interface that communicates with the graph worker thread
#[cfg_attr(any(test, feature = "testing"), mockall::automock)]
#[cfg_attr(feature = "test-exports", mockall::automock)]
pub trait ConsensusController: Send + Sync {
/// Get an export of a part of the graph
///
Expand Down
4 changes: 2 additions & 2 deletions massa-consensus-exports/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ pub use channels::{ConsensusBroadcasts, ConsensusChannels};
pub use controller_trait::{ConsensusController, ConsensusManager};
pub use settings::ConsensusConfig;

#[cfg(feature = "testing")]
#[cfg(feature = "test-exports")]
pub use controller_trait::MockConsensusController;

/// Test utils
#[cfg(feature = "testing")]
#[cfg(feature = "test-exports")]
/// Exports related to tests as Mocks and configurations
pub mod test_exports;
8 changes: 4 additions & 4 deletions massa-consensus-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
[features]
sandbox = []
bootstrap_server = []
testing = ["tokio", "crossbeam-channel", "massa_execution_exports/testing", "massa_protocol_exports/testing", "massa_consensus_exports/testing", "massa_pos_exports/testing", "massa_pool_exports/testing"]
test-exports = ["tokio", "crossbeam-channel", "massa_execution_exports/test-exports", "massa_protocol_exports/test-exports", "massa_consensus_exports/test-exports", "massa_pos_exports/test-exports", "massa_pool_exports/test-exports"]

[dependencies]
num = {workspace = true, "features" = ["serde"]} # BOM UPGRADE Revert to {"version": "0.4", "features": ["serde"]} if problem
Expand All @@ -32,9 +32,9 @@ tokio = {workspace = true, "optional" = true} # BOM UPGRADE Revert to {"ve
crossbeam-channel = {workspace = true, "optional" = true} # BOM UPGRADE Revert to {"version": "0.5.6", "optional": true} if problem

[dev-dependencies]
massa_pool_exports = {workspace = true, features = ["testing"]}
massa_pos_exports = {workspace = true, features = ["testing"]}
massa_protocol_exports = {workspace = true, features = ["testing"]}
massa_pool_exports = {workspace = true, features = ["test-exports"]}
massa_pos_exports = {workspace = true, features = ["test-exports"]}
massa_protocol_exports = {workspace = true, features = ["test-exports"]}
massa_test_framework = {workspace = true}
mockall = {workspace = true}
rand = {workspace = true}
Expand Down
2 changes: 1 addition & 1 deletion massa-executed-ops/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ massa_hash = {workspace = true}
parking_lot = {workspace = true}

[features]
testing = ["massa_models/testing"]
test-exports = ["massa_models/test-exports"]
2 changes: 1 addition & 1 deletion massa-execution-exports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[features]
gas_calibration = ["tempfile"]
testing = ["massa_models/testing", "tempfile", "mockall"]
test-exports = ["massa_models/test-exports", "tempfile", "mockall"]

[dependencies]
displaydoc = {workspace = true}
Expand Down
2 changes: 1 addition & 1 deletion massa-execution-exports/src/controller_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use massa_models::stats::ExecutionStats;
use std::collections::BTreeMap;
use std::collections::HashMap;

#[cfg_attr(any(test, feature = "testing"), mockall::automock)]
#[cfg_attr(feature = "test-exports", mockall::automock)]
/// interface that communicates with the execution worker thread
pub trait ExecutionController: Send + Sync {
/// Updates blockclique status by signaling newly finalized blocks and the latest blockclique.
Expand Down
6 changes: 3 additions & 3 deletions massa-execution-exports/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//!
//! ## Test exports
//!
//! When the crate feature `testing` is enabled, tooling useful for testing purposes is exported.
//! When the crate feature `test-exports` is enabled, tooling useful for test-exports purposes is exported.
//! See `test_exports/mod.rs` for details.

#![warn(missing_docs)]
Expand All @@ -54,7 +54,7 @@ mod settings;
mod types;

pub use channels::ExecutionChannels;
#[cfg(any(test, feature = "testing"))]
#[cfg(feature = "test-exports")]
pub use controller_traits::MockExecutionController;
pub use controller_traits::{ExecutionController, ExecutionManager};
pub use error::{ExecutionError, ExecutionQueryError};
Expand All @@ -69,5 +69,5 @@ pub use types::{
ReadOnlyExecutionRequest, ReadOnlyExecutionTarget, SlotExecutionOutput,
};

#[cfg(any(feature = "testing", feature = "gas_calibration"))]
#[cfg(any(feature = "test-exports", feature = "gas_calibration"))]
pub mod test_exports;
2 changes: 1 addition & 1 deletion massa-execution-exports/src/test_exports/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2022 MASSA LABS <info@massa.net>

//! This module exposes useful tooling for testing.
//! It is only compiled and exported by the crate if the "testing" feature is enabled.
//! It is only compiled and exported by the crate if the "test-exports" feature is enabled.
//!
//!
//! # Architecture
Expand Down
30 changes: 15 additions & 15 deletions massa-execution-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ sandbox = ["massa_async_pool/sandbox"]
gas_calibration = [
"massa-sc-runtime/gas_calibration",
"massa_execution_exports/gas_calibration",
"massa_final_state/testing",
"massa_final_state/test-exports",
"massa_pos_worker",
"massa_ledger_worker",
"massa_db_worker",
"tempfile",
]
testing = [
"massa_execution_exports/testing",
"massa_ledger_exports/testing",
"massa_pos_exports/testing",
"massa_final_state/testing",
test-exports = [
"massa_execution_exports/test-exports",
"massa_ledger_exports/test-exports",
"massa_pos_exports/test-exports",
"massa_final_state/test-exports",
"massa-sc-runtime/testing",
"massa_wallet/testing",
"massa_wallet/test-exports",
"tempfile",
"massa_pos_worker",
"massa_ledger_worker",
"massa_metrics/testing",
"massa_metrics/test-exports",
"massa_db_worker",
"massa_metrics/testing",
"massa_metrics/test-exports",
]
benchmarking = [
"massa-sc-runtime/gas_calibration",
Expand Down Expand Up @@ -85,14 +85,14 @@ massa-proto-rs = { workspace = true }

[dev-dependencies]
massa_storage = { workspace = true }
massa_execution_exports = { workspace = true, features = ["testing"] }
massa_final_state = { workspace = true, features = ["testing"] }
massa_ledger_exports = { workspace = true, features = ["testing"] }
massa_pos_exports = { workspace = true, features = ["testing"] }
massa_execution_exports = { workspace = true, features = ["test-exports"] }
massa_final_state = { workspace = true, features = ["test-exports"] }
massa_ledger_exports = { workspace = true, features = ["test-exports"] }
massa_pos_exports = { workspace = true, features = ["test-exports"] }
massa_pos_worker = { workspace = true }
massa-sc-runtime = { workspace = true, features = ["testing"] }
massa_wallet = { workspace = true, features = ["testing"] }
massa_metrics = { workspace = true, features = ["testing"] }
massa_wallet = { workspace = true, features = ["test-exports"] }
massa_metrics = { workspace = true, features = ["test-exports"] }
massa_db_worker = { workspace = true }
tokio = { workspace = true, features = ["sync"] }
massa_ledger_worker = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions massa-execution-worker/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ pub struct ExecutionContext {
#[cfg(all(
not(feature = "gas_calibration"),
not(feature = "benchmarking"),
not(feature = "testing"),
not(feature = "test-exports"),
not(test)
))]
speculative_ledger: SpeculativeLedger,
#[cfg(any(
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing",
feature = "test-exports",
test
))]
pub(crate) speculative_ledger: SpeculativeLedger,
Expand Down
6 changes: 3 additions & 3 deletions massa-execution-worker/src/interface_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use massa_time::MassaTime;
#[cfg(any(
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing",
feature = "test-exports",
test
))]
use num::rational::Ratio;
Expand All @@ -46,7 +46,7 @@ use tracing::debug;
#[cfg(any(
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing",
feature = "test-exports",
test
))]
use massa_models::datastore::Datastore;
Expand Down Expand Up @@ -80,7 +80,7 @@ impl InterfaceImpl {
#[cfg(any(
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing",
feature = "test-exports",
test
))]
/// Used to create an default interface to run SC in a test environment
Expand Down
4 changes: 2 additions & 2 deletions massa-execution-worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub use worker::start_execution_worker;
#[cfg(any(
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing"
feature = "test-exports"
))]
pub use interface_impl::InterfaceImpl;

Expand All @@ -111,6 +111,6 @@ use criterion as _;
test,
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing"
feature = "test-exports"
))]
mod tests;
4 changes: 2 additions & 2 deletions massa-execution-worker/src/speculative_ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ pub(crate) struct SpeculativeLedger {
#[cfg(all(
not(feature = "gas_calibration"),
not(feature = "benchmarking"),
not(feature = "testing"),
not(feature = "test-exports"),
not(test)
))]
added_changes: LedgerChanges,
#[cfg(any(
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing",
feature = "test-exports",
test
))]
pub added_changes: LedgerChanges,
Expand Down
5 changes: 3 additions & 2 deletions massa-execution-worker/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
test,
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing"
feature = "test-exports",
test
))]
mod mock;

Expand All @@ -19,7 +20,7 @@ mod interface;
#[cfg(any(
feature = "gas_calibration",
feature = "benchmarking",
feature = "testing",
feature = "test-exports",
test
))]
pub use mock::get_sample_state;
2 changes: 1 addition & 1 deletion massa-factory-exports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Massa Labs <info@massa.net>"]
edition = "2021"

[features]
testing = ["massa_models/testing", "massa_protocol_exports/testing", "massa_pool_exports/testing"]
test-exports = ["massa_models/test-exports", "massa_protocol_exports/test-exports", "massa_pool_exports/test-exports"]
sandbox = []

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion massa-factory-exports/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ pub use error::*;
pub use types::*;

/// Tests utils
#[cfg(feature = "testing")]
#[cfg(feature = "test-exports")]
pub mod test_exports;
14 changes: 7 additions & 7 deletions massa-factory-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[features]
sandbox = []
testing = ["massa_factory_exports/testing", "massa_pos_exports/testing", "massa_pool_exports/testing", "massa_protocol_exports/testing", "massa_wallet/testing"]
test-exports = ["massa_factory_exports/test-exports", "massa_pos_exports/test-exports", "massa_pool_exports/test-exports", "massa_protocol_exports/test-exports", "massa_wallet/test-exports"]

[dependencies]
parking_lot = {workspace = true, "features" = ["deadlock_detection"]}
Expand All @@ -26,10 +26,10 @@ massa_versioning = {workspace = true}
[dev-dependencies]
num = {workspace = true}
massa_hash = {workspace = true}
massa_protocol_exports = {workspace = true, "features" = ["testing"]}
massa_consensus_exports = {workspace = true, "features" = ["testing"]}
massa_factory_exports = {workspace = true, "features" = ["testing"]}
massa_wallet = {workspace = true, "features" = ["testing"]}
massa_pos_exports = {workspace = true, "features" = ["testing"]}
massa_pool_exports = {workspace = true, "features" = ["testing"]}
massa_protocol_exports = {workspace = true, "features" = ["test-exports"]}
massa_consensus_exports = {workspace = true, "features" = ["test-exports"]}
massa_factory_exports = {workspace = true, "features" = ["test-exports"]}
massa_wallet = {workspace = true, "features" = ["test-exports"]}
massa_pos_exports = {workspace = true, "features" = ["test-exports"]}
massa_pool_exports = {workspace = true, "features" = ["test-exports"]}
serial_test = { workspace = true }
Loading

0 comments on commit 96e4af1

Please sign in to comment.