Make test-client generic over runtime (#2824)

* Make test-client generic over runtime.

* Make sure genesis storage is constructed correctly.

* Use prelude in tests.

* Add an example of how to use test-client with node/runtime.

* Bump version.

* Rename test-clients.
This commit is contained in:
Tomasz Drwięga
2019-06-11 21:54:34 +02:00
committed by Bastian Köcher
parent cae324598f
commit ad2d958248
36 changed files with 497 additions and 342 deletions
+15
View File
@@ -895,6 +895,21 @@ mod tests {
assert!(t.storage_changes_root(GENESIS_HASH.into()).unwrap().is_some());
}
#[test]
fn should_import_block_with_test_client() {
use test_client::{ClientExt, TestClientBuilder, consensus::BlockOrigin};
let client = TestClientBuilder::default()
.build_with_native_executor::<Block, node_runtime::RuntimeApi, _>(executor())
.0;
let block1 = changes_trie_block();
let block_data = block1.0;
let block = Block::decode(&mut &block_data[..]).unwrap();
client.import(BlockOrigin::Own, block).unwrap();
}
#[cfg(feature = "benchmarks")]
mod benches {
use super::*;