Unverified Commit 71475c85 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Make sure the adder collator fails when something is wrong (#2450)

As futures most of the time are catching panics and we don't check this,
it could happen that we have some statement that isn't correct but the
test succeeds successfully.
parent f877b041
Pipeline #124406 passed with stages
in 33 minutes and 53 seconds
......@@ -9217,7 +9217,6 @@ dependencies = [
name = "test-parachain-adder-collator"
version = "0.7.26"
dependencies = [
"assert_matches",
"futures 0.3.12",
"futures-timer 3.0.2",
"log",
......
......@@ -15,7 +15,6 @@ futures = "0.3.12"
futures-timer = "3.0.2"
log = "0.4.13"
structopt = "0.3.21"
assert_matches = "1.4.0"
test-parachain-adder = { path = ".." }
polkadot-primitives = { path = "../../../../primitives" }
......
......@@ -28,7 +28,6 @@ use std::{
};
use test_parachain_adder::{execute, hash_state, BlockData, HeadData};
use futures::channel::oneshot;
use assert_matches::assert_matches;
/// The amount we add when producing a new block.
///
......@@ -180,11 +179,13 @@ impl Collator {
let seconded_collations = seconded_collations.clone();
spawner.spawn("adder-collator-seconded", async move {
if let Ok(res) = recv.await {
assert_matches!(
if !matches!(
res.payload(),
Statement::Seconded(s) if s.descriptor.pov_hash == pov.hash(),
"Seconded statement should match our collation!",
);
) {
log::error!("Seconded statement should match our collation: {:?}", res.payload());
std::process::exit(-1);
}
seconded_collations.fetch_add(1, Ordering::Relaxed);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment