Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
RUSTC_WORKSPACE_WRAPPER: sccache
with:
command: clippy
args: -- --no-deps -D warnings
args: --all-targets --all-features -- --no-deps -D warnings

- name: Run Unit Test Suite
uses: actions-rs/cargo@v1
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::accounts::{get_sudo_key, get_validators_keys, get_validators_seeds, N

static GLOBAL_CONFIG: Lazy<Config> = Lazy::new(|| {
let node = get_env("NODE_URL").unwrap_or_else(|| "ws://127.0.0.1:9943".to_string());
let validator_count = get_env("VALIDATOR_COUNT").unwrap_or_else(|| 5);
let validator_count = get_env("VALIDATOR_COUNT").unwrap_or(5);
let validators_seeds = env::var("VALIDATORS_SEEDS")
.ok()
.map(|s| s.split(',').map(|s| s.to_string()).collect());
Expand Down Expand Up @@ -41,7 +41,7 @@ where
{
env::var(name).ok().map(|v| {
v.parse()
.expect(&format!("Failed to parse env var {}", name))
.unwrap_or_else(|_| panic!("Failed to parse env var {}", name))
})
}

Expand Down
24 changes: 22 additions & 2 deletions finality-aleph/src/network/clique/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ use std::{

use codec::{Decode, Encode};
use futures::{
channel::{mpsc, oneshot},
StreamExt,
channel::{mpsc, mpsc::UnboundedReceiver, oneshot},
Future, StreamExt,
};
use log::info;
use rand::Rng;
use tokio::io::{duplex, AsyncRead, AsyncWrite, DuplexStream, ReadBuf};

use crate::network::{
clique::{
protocols::{ProtocolError, ResultForService},
ConnectionInfo, Dialer, Listener, Network, PeerAddressInfo, PublicKey, SecretKey,
Splittable, LOG_TARGET,
},
Expand Down Expand Up @@ -290,6 +291,12 @@ impl<D: Data> MockNetwork<D> {
}
}

impl<D: Data> Default for MockNetwork<D> {
fn default() -> Self {
Self::new()
}
}

/// Bidirectional in-memory stream that closes abruptly after a specified
/// number of poll_write calls.
#[derive(Debug)]
Expand Down Expand Up @@ -535,3 +542,16 @@ impl UnreliableConnectionMaker {
}
}
}

pub struct MockPrelims<D> {
pub id_incoming: MockPublicKey,
pub pen_incoming: MockSecretKey,
pub id_outgoing: MockPublicKey,
pub pen_outgoing: MockSecretKey,
pub incoming_handle: Pin<Box<dyn Future<Output = Result<(), ProtocolError<MockPublicKey>>>>>,
pub outgoing_handle: Pin<Box<dyn Future<Output = Result<(), ProtocolError<MockPublicKey>>>>>,
pub data_from_incoming: UnboundedReceiver<D>,
pub data_from_outgoing: Option<UnboundedReceiver<D>>,
pub result_from_incoming: UnboundedReceiver<ResultForService<MockPublicKey, D>>,
pub result_from_outgoing: UnboundedReceiver<ResultForService<MockPublicKey, D>>,
}
Loading