Skip to content

Commit

Permalink
Move test-validator to own module to reduce core dependencies (solana…
Browse files Browse the repository at this point in the history
…-labs#20658)

* Move test-validator to own module to reduce core dependencies

* Fix a few TestValidator paths

* Use solana_test_validator crate for solana_test_validator bin

* Move client int tests to separate crate

Co-authored-by: Tyera Eulberg <tyera@solana.com>
  • Loading branch information
sakridge and Tyera Eulberg authored Oct 29, 2021
1 parent e16c060 commit a8d78e8
Show file tree
Hide file tree
Showing 26 changed files with 193 additions and 27 deletions.
70 changes: 65 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ members = [
"watchtower",
"replica-node",
"replica-lib",
"test-validator",
"rpc-test",
"client-test",
]

exclude = [
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ thiserror = "1.0.30"
tiny-bip39 = "0.8.2"

[dev-dependencies]
solana-core = { path = "../core", version = "=1.9.0" }
solana-streamer = { path = "../streamer", version = "=1.9.0" }
solana-test-validator = { path = "../test-validator", version = "=1.9.0" }
tempfile = "3.2.0"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use solana_client::{
nonce_utils,
rpc_client::RpcClient,
};
use solana_core::test_validator::TestValidator;
use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{
commitment_config::CommitmentConfig,
Expand All @@ -19,6 +18,7 @@ use solana_sdk::{
system_program,
};
use solana_streamer::socket::SocketAddrSpace;
use solana_test_validator::TestValidator;

#[test]
fn test_nonce() {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use solana_cli::{
};
use solana_cli_output::OutputFormat;
use solana_client::rpc_client::RpcClient;
use solana_core::test_validator::TestValidator;
use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{
account_utils::StateMut,
Expand All @@ -16,6 +15,7 @@ use solana_sdk::{
signature::{Keypair, Signer},
};
use solana_streamer::socket::SocketAddrSpace;
use solana_test_validator::TestValidator;
use std::{env, fs::File, io::Read, path::PathBuf, str::FromStr};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/request_airdrop.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use solana_cli::cli::{process_command, CliCommand, CliConfig};
use solana_client::rpc_client::RpcClient;
use solana_core::test_validator::TestValidator;
use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{
commitment_config::CommitmentConfig,
signature::{Keypair, Signer},
};
use solana_streamer::socket::SocketAddrSpace;
use solana_test_validator::TestValidator;

#[test]
fn test_cli_request_airdrop() {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use solana_client::{
nonce_utils,
rpc_client::RpcClient,
};
use solana_core::test_validator::TestValidator;
use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{
account_utils::StateMut,
Expand All @@ -26,6 +25,7 @@ use solana_sdk::{
},
};
use solana_streamer::socket::SocketAddrSpace;
use solana_test_validator::TestValidator;

#[test]
fn test_stake_delegation_force() {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use solana_client::{
nonce_utils,
rpc_client::RpcClient,
};
use solana_core::test_validator::TestValidator;
use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{
commitment_config::CommitmentConfig,
Expand All @@ -20,6 +19,7 @@ use solana_sdk::{
stake,
};
use solana_streamer::socket::SocketAddrSpace;
use solana_test_validator::TestValidator;

#[test]
fn test_transfer() {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ use solana_client::{
blockhash_query::{self, BlockhashQuery},
rpc_client::RpcClient,
};
use solana_core::test_validator::TestValidator;
use solana_faucet::faucet::run_local_faucet;
use solana_sdk::{
account_utils::StateMut,
commitment_config::CommitmentConfig,
signature::{Keypair, Signer},
};
use solana_streamer::socket::SocketAddrSpace;
use solana_test_validator::TestValidator;
use solana_vote_program::vote_state::{VoteAuthorize, VoteState, VoteStateVersions};

#[test]
Expand Down
35 changes: 35 additions & 0 deletions client-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "solana-client-test"
version = "1.9.0"
description = "Solana RPC Test"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
documentation = "https://docs.rs/solana-client-test"
edition = "2018"

[dependencies]
solana-client = { path = "../client", version = "=1.9.0" }
solana-measure = { path = "../measure", version = "=1.9.0" }
solana-merkle-tree = { path = "../merkle-tree", version = "=1.9.0" }
solana-metrics = { path = "../metrics", version = "=1.9.0" }
solana-perf = { path = "../perf", version = "=1.9.0" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "=1.9.0" }
solana-rpc = { path = "../rpc", version = "=1.9.0" }
solana-runtime = { path = "../runtime", version = "=1.9.0" }
solana-sdk = { path = "../sdk", version = "=1.9.0" }
solana-streamer = { path = "../streamer", version = "=1.9.0" }
solana-test-validator = { path = "../test-validator", version = "=1.9.0" }
solana-version = { path = "../version", version = "=1.9.0" }
systemstat = "0.1.10"

[dev-dependencies]
solana-logger = { path = "../logger", version = "=1.9.0" }

[lib]
crate-type = ["lib"]
name = "solana_entry"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
1 change: 1 addition & 0 deletions client-test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is a test-only crate
2 changes: 1 addition & 1 deletion core/tests/client.rs → client-test/tests/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use solana_client::{pubsub_client::PubsubClient, rpc_client::RpcClient, rpc_response::SlotInfo};
use solana_core::test_validator::TestValidator;
use solana_rpc::{
optimistically_confirmed_bank_tracker::OptimisticallyConfirmedBank,
rpc_pubsub_service::{PubSubConfig, PubSubService},
Expand All @@ -19,6 +18,7 @@ use solana_sdk::{
system_transaction,
};
use solana_streamer::socket::SocketAddrSpace;
use solana_test_validator::TestValidator;
use std::{
net::{IpAddr, SocketAddr},
sync::{
Expand Down
3 changes: 0 additions & 3 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ rayon = "1.5.1"
retain_mut = "0.1.4"
serde = "1.0.130"
serde_derive = "1.0.103"
solana-account-decoder = { path = "../account-decoder", version = "=1.9.0" }
solana-accountsdb-plugin-manager = { path = "../accountsdb-plugin-manager", version = "=1.9.0" }
solana-client = { path = "../client", version = "=1.9.0" }
solana-config-program = { path = "../programs/config", version = "=1.9.0" }
solana-entry = { path = "../entry", version = "=1.9.0" }
solana-gossip = { path = "../gossip", version = "=1.9.0" }
solana-ledger = { path = "../ledger", version = "=1.9.0" }
Expand All @@ -47,7 +45,6 @@ solana-metrics = { path = "../metrics", version = "=1.9.0" }
solana-net-utils = { path = "../net-utils", version = "=1.9.0" }
solana-perf = { path = "../perf", version = "=1.9.0" }
solana-poh = { path = "../poh", version = "=1.9.0" }
solana-program-test = { path = "../program-test", version = "=1.9.0" }
solana-rpc = { path = "../rpc", version = "=1.9.0" }
solana-replica-lib = { path = "../replica-lib", version = "=1.9.0" }
solana-runtime = { path = "../runtime", version = "=1.9.0" }
Expand Down
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pub mod sigverify_shreds;
pub mod sigverify_stage;
pub mod snapshot_packager_service;
pub mod system_monitor_service;
pub mod test_validator;
pub mod tower_storage;
pub mod tpu;
pub mod tree_diff;
Expand Down
2 changes: 1 addition & 1 deletion core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ pub struct Validator {
}

// in the distant future, get rid of ::new()/exit() and use Result properly...
pub(crate) fn abort() -> ! {
pub fn abort() -> ! {
#[cfg(not(test))]
{
// standard error is usually redirected to a log file, cry for help on standard output as
Expand Down
38 changes: 38 additions & 0 deletions rpc-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "solana-rpc-test"
version = "1.9.0"
description = "Solana RPC Test"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
documentation = "https://docs.rs/solana-rpc-test"
edition = "2018"

[dependencies]
bincode = "1.3.3"
bs58 = "0.4.0"
jsonrpc-core = "18.0.0"
jsonrpc-core-client = { version = "18.0.0", features = ["ipc", "ws"] }
log = "0.4.11"
reqwest = { version = "0.11.5", default-features = false, features = ["blocking", "rustls-tls", "json"] }
serde = "1.0.130"
serde_json = "1.0.68"
solana-account-decoder = { path = "../account-decoder", version = "=1.9.0" }
solana-client = { path = "../client", version = "=1.9.0" }
solana-rpc = { path = "../rpc", version = "=1.9.0" }
solana-sdk = { path = "../sdk", version = "=1.9.0" }
solana-streamer = { path = "../streamer", version = "=1.9.0" }
solana-test-validator = { path = "../test-validator", version = "=1.9.0" }
solana-transaction-status = { path = "../transaction-status", version = "=1.9.0" }
tokio = { version = "1", features = ["full"] }

[dev-dependencies]
solana-logger = { path = "../logger", version = "=1.9.0" }

[lib]
crate-type = ["lib"]
name = "solana_entry"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
1 change: 1 addition & 0 deletions rpc-test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is a test-only crate
2 changes: 1 addition & 1 deletion core/tests/rpc.rs → rpc-test/tests/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use solana_client::{
rpc_response::{Response as RpcResponse, RpcSignatureResult, SlotUpdate},
tpu_client::{TpuClient, TpuClientConfig},
};
use solana_core::test_validator::TestValidator;
use solana_rpc::rpc_pubsub::gen_client::Client as PubsubClient;
use solana_test_validator::TestValidator;

use solana_sdk::{
commitment_config::CommitmentConfig,
Expand Down
Loading

0 comments on commit a8d78e8

Please sign in to comment.