Skip to content

Commit

Permalink
snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
pompon0 committed Nov 6, 2023
1 parent c35c261 commit 762aa97
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions node/actors/consensus/src/replica/tests.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::testonly;
use rand::Rng;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, scope, time};
use zksync_consensus_network::io::{ConsensusInputMessage, Target};
use zksync_consensus_roles::validator::{self, ViewNumber};

#[tokio::test]
async fn start_new_view_not_leader() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::ManualClock::new());
let rng = &mut ctx.rng();

Expand Down
4 changes: 2 additions & 2 deletions node/actors/consensus/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use crate::{
misc::consensus_threshold,
testonly::{Behavior, Network, Test},
};
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::ctx;

async fn run_test(behavior: Behavior, network: Network) {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::AffineClock::new(1.));

const NODES: usize = 11;
Expand Down
6 changes: 3 additions & 3 deletions node/actors/executor/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::*;
use rand::Rng;
use std::collections::HashMap;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::sync;
use zksync_consensus_consensus::testonly::make_genesis;
use zksync_consensus_network::testonly::Instance;
Expand Down Expand Up @@ -95,7 +95,7 @@ impl FullValidatorConfig {

#[tokio::test]
async fn executing_single_validator() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::root();
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -123,7 +123,7 @@ async fn executing_single_validator() {

#[tokio::test]
async fn executing_validator_and_external_node() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::AffineClock::new(20.0));
let rng = &mut ctx.rng();

Expand Down
8 changes: 4 additions & 4 deletions node/actors/network/src/consensus/handshake/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::*;
use crate::{frame, noise, testonly};
use rand::Rng;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, io, scope};
use zksync_consensus_roles::validator;
use zksync_consensus_schema as schema;
Expand All @@ -14,7 +14,7 @@ fn test_schema_encode_decode() {

#[tokio::test]
async fn test_session_id_mismatch() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -81,7 +81,7 @@ async fn test_session_id_mismatch() {

#[tokio::test]
async fn test_peer_mismatch() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -111,7 +111,7 @@ async fn test_peer_mismatch() {

#[tokio::test]
async fn test_invalid_signature() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down
8 changes: 4 additions & 4 deletions node/actors/network/src/consensus/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use crate::{io, preface, rpc, run_network, testonly};
use anyhow::Context as _;
use rand::Rng;
use tracing::Instrument as _;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, net, scope};
use zksync_consensus_roles::validator;
use zksync_consensus_utils::pipe;

#[tokio::test]
async fn test_one_connection_per_validator() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -67,7 +67,7 @@ async fn test_one_connection_per_validator() {

#[tokio::test(flavor = "multi_thread")]
async fn test_address_change() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::AffineClock::new(20.));
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -145,7 +145,7 @@ async fn test_address_change() {
/// encrypted authenticated multiplexed stream.
#[tokio::test]
async fn test_transmission() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down
8 changes: 4 additions & 4 deletions node/actors/network/src/gossip/handshake/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::*;
use crate::{frame, noise, testonly};
use rand::Rng;
use std::collections::{HashMap, HashSet};
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, io, scope};
use zksync_consensus_roles::node;
use zksync_consensus_schema as schema;
Expand All @@ -25,7 +25,7 @@ fn make_cfg<R: Rng>(rng: &mut R) -> Config {

#[tokio::test]
async fn test_session_id_mismatch() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -93,7 +93,7 @@ async fn test_session_id_mismatch() {

#[tokio::test]
async fn test_peer_mismatch() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -123,7 +123,7 @@ async fn test_peer_mismatch() {

#[tokio::test]
async fn test_invalid_signature() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down
18 changes: 9 additions & 9 deletions node/actors/network/src/gossip/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{
};
use test_casing::{test_casing, Product};
use tracing::Instrument as _;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{
ctx::{self, channel},
oneshot, scope,
Expand All @@ -22,7 +22,7 @@ use zksync_consensus_utils::pipe;

#[tokio::test]
async fn test_one_connection_per_node() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -150,7 +150,7 @@ impl View {

#[tokio::test]
async fn test_validator_addrs() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let rng = &mut ctx::test_root(&ctx::RealClock).rng();

let keys: Vec<validator::SecretKey> = (0..8).map(|_| rng.gen()).collect();
Expand Down Expand Up @@ -233,7 +233,7 @@ fn to_addr_map(addrs: &ValidatorAddrs) -> HashMap<validator::PublicKey, std::net

#[tokio::test(flavor = "multi_thread")]
async fn test_validator_addrs_propagation() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::AffineClock::new(40.));
let rng = &mut ctx.rng();
let nodes: Vec<_> = testonly::Instance::new(rng, 10, 1);
Expand Down Expand Up @@ -277,7 +277,7 @@ const NETWORK_CONNECTIVITY_CASES: [(usize, usize); 5] = [(2, 1), (3, 2), (5, 3),
#[tokio::test(flavor = "multi_thread")]
#[tracing::instrument(level = "trace")]
async fn syncing_blocks(node_count: usize, gossip_peers: usize) {
concurrency::testonly::abort_on_panic();
abort_on_panic();

let ctx = &ctx::test_root(&ctx::AffineClock::new(20.0));
let ctx = &ctx.with_timeout(time::Duration::seconds(200));
Expand Down Expand Up @@ -398,7 +398,7 @@ async fn uncoordinated_block_syncing(
(node_count, gossip_peers): (usize, usize),
state_generation_interval: time::Duration,
) {
concurrency::testonly::abort_on_panic();
abort_on_panic();

let ctx = &ctx::test_root(&ctx::AffineClock::new(20.0));
let ctx = &ctx.with_timeout(time::Duration::seconds(200));
Expand Down Expand Up @@ -482,7 +482,7 @@ async fn run_mock_uncoordinated_dispatcher(
#[test_casing(5, NETWORK_CONNECTIVITY_CASES)]
#[tokio::test]
async fn getting_blocks_from_peers(node_count: usize, gossip_peers: usize) {
concurrency::testonly::abort_on_panic();
abort_on_panic();

let ctx = &ctx::test_root(&ctx::ManualClock::new());
let rng = &mut ctx.rng();
Expand Down Expand Up @@ -595,7 +595,7 @@ async fn run_get_block_dispatcher(
/// the AccountData that is present in the network from the previous run.
#[tokio::test]
async fn validator_node_restart() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let clock = &ctx::ManualClock::new();
let ctx = &ctx::test_root(clock);
let rng = &mut ctx.rng();
Expand Down Expand Up @@ -679,7 +679,7 @@ async fn validator_node_restart() {
/// to receive all updates in 2 rounds of communication.
#[tokio::test]
async fn rate_limiting() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let clock = &ctx::ManualClock::new();
let ctx = &ctx::test_root(clock);
let rng = &mut ctx.rng();
Expand Down
8 changes: 4 additions & 4 deletions node/actors/network/src/mux/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
Arc,
},
};
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, scope};
use zksync_consensus_schema as schema;
use zksync_consensus_schema::proto::network::mux_test as proto;
Expand Down Expand Up @@ -195,8 +195,8 @@ fn expected(res: Result<(), mux::RunError>) -> Result<(), mux::RunError> {
// checking 1 property at a time should be added.
#[test]
fn mux_with_noise() {
concurrency::testonly::abort_on_panic();
concurrency::testonly::with_runtimes(|| async {
abort_on_panic();
zksync_concurrency::testonly::with_runtimes(|| async {
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();

Expand Down Expand Up @@ -285,7 +285,7 @@ fn mux_with_noise() {

#[tokio::test]
async fn test_transport_closed() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let cap: mux::CapabilityId = 0;
let cfg = Arc::new(mux::Config {
Expand Down
8 changes: 4 additions & 4 deletions node/actors/network/src/noise/tests.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::noise;
use rand::Rng;
use tracing::instrument::Instrument as _;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, io, scope};

#[tokio::test]
async fn transmit_ok() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let (mut s1, mut s2) = noise::testonly::pipe(ctx).await;
let msg = "hello";
Expand Down Expand Up @@ -45,7 +45,7 @@ async fn transmit_ok() {

#[tokio::test]
async fn transmit_sender_dies() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let (mut s1, mut s2) = noise::testonly::pipe(ctx).await;
let msg = "hello";
Expand Down Expand Up @@ -75,7 +75,7 @@ async fn transmit_sender_dies() {

#[tokio::test]
async fn transmit_receiver_dies() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();
let (s1, s2) = noise::testonly::pipe(ctx).await;
Expand Down
8 changes: 4 additions & 4 deletions node/actors/network/src/rpc/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
collections::HashSet,
sync::atomic::{AtomicU64, Ordering},
};
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, time};

/// CAPABILITY_ID should uniquely identify the RPC.
Expand Down Expand Up @@ -35,7 +35,7 @@ fn expected(res: Result<(), mux::RunError>) -> Result<(), mux::RunError> {

#[tokio::test]
async fn test_ping() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let clock = ctx::ManualClock::new();
let ctx = &ctx::test_root(&clock);
let (s1, s2) = noise::testonly::pipe(ctx).await;
Expand Down Expand Up @@ -87,7 +87,7 @@ impl Handler<ping::Rpc> for PingServer {

#[tokio::test]
async fn test_ping_loop() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let clock = ctx::ManualClock::new();
clock.set_advance_on_sleep();
let ctx = &ctx::test_root(&clock);
Expand Down Expand Up @@ -151,7 +151,7 @@ impl Handler<ExampleRpc> for ExampleServer {

#[tokio::test]
async fn test_inflight() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &ctx::test_root(&ctx::RealClock);
let (s1, s2) = noise::testonly::pipe(ctx).await;
let client = Client::<ExampleRpc>::new(ctx);
Expand Down
4 changes: 2 additions & 2 deletions node/actors/network/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use crate::{run_network, testonly};
use tracing::Instrument as _;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::{ctx, scope};
use zksync_consensus_utils::pipe;

/// Test that metrics are correctly defined
/// (won't panic during registration).
#[tokio::test]
async fn test_metrics() {
concurrency::testonly::abort_on_panic();
abort_on_panic();
let ctx = &mut ctx::test_root(&ctx::RealClock);
let rng = &mut ctx.rng();
let nodes = testonly::Instance::new(rng, 3, 1);
Expand Down
4 changes: 2 additions & 2 deletions node/actors/sync_blocks/src/peers/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use async_trait::async_trait;
use rand::{rngs::StdRng, seq::IteratorRandom, Rng};
use std::{collections::HashSet, fmt};
use test_casing::{test_casing, Product};
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::time;
use zksync_consensus_roles::validator;
use zksync_consensus_storage::{BlockStore, InMemoryStorage};
Expand Down Expand Up @@ -85,7 +85,7 @@ async fn wait_for_peer_update(

#[instrument(level = "trace")]
async fn test_peer_states<T: Test>(test: T) {
concurrency::testonly::abort_on_panic();
abort_on_panic();

let ctx = &ctx::test_root(&ctx::RealClock).with_timeout(TEST_TIMEOUT);
let clock = ctx::ManualClock::new();
Expand Down
4 changes: 2 additions & 2 deletions node/actors/sync_blocks/src/tests/end_to_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rand::seq::SliceRandom;
use std::fmt;
use test_casing::test_casing;
use tracing::Instrument;
use zksync_concurrency as concurrency;
use zksync_concurrency::testonly::abort_on_panic;
use zksync_concurrency::ctx::channel;
use zksync_consensus_network as network;
use zksync_consensus_network::testonly::Instance as NetworkInstance;
Expand Down Expand Up @@ -229,7 +229,7 @@ trait GossipNetworkTest: fmt::Debug + Send {
async fn test_sync_blocks<T: GossipNetworkTest>(test: T) {
const CLOCK_SPEEDUP: u32 = 25;

concurrency::testonly::abort_on_panic();
abort_on_panic();

let ctx = &ctx::test_root(&ctx::AffineClock::new(CLOCK_SPEEDUP as f64))
.with_timeout(TEST_TIMEOUT * CLOCK_SPEEDUP);
Expand Down
Loading

0 comments on commit 762aa97

Please sign in to comment.