Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
69732ef
substrate-test-runner
seunlanlege Dec 2, 2020
46cae57
PR grumbles
seunlanlege Jan 13, 2021
25bebb4
minor fixes
seunlanlege Jan 13, 2021
fd4fbef
bye test-runner
seunlanlege Jan 13, 2021
f5871d8
u128->u64
seunlanlege Jan 14, 2021
a1d8209
u64->u8
seunlanlege Jan 14, 2021
1c70a7f
patch manual seal
seunlanlege Jan 15, 2021
9a6c65a
patch manual seal
seunlanlege Jan 18, 2021
374df70
patch manual seal
seunlanlege Jan 18, 2021
6b965b9
make tests take args, make root calls dispatch generic
seunlanlege Jan 21, 2021
c566a90
runtime upgrade
seunlanlege Jan 21, 2021
f0f1bee
Update bin/node/e2e-tests/src/lib.rs
seunlanlege Jan 21, 2021
74421dc
Merge branch 'master' of github.com:paritytech/substrate into substra…
seunlanlege Feb 8, 2021
9bc449f
...
seunlanlege Feb 8, 2021
3af7142
Merge branch 'master' of github.com:paritytech/substrate into substra…
Mar 3, 2021
4364ddc
hi test-runner
Mar 3, 2021
c2c6519
Merge branch 'master' of github.com:paritytech/substrate into substra…
Mar 3, 2021
3f19754
Apply suggestions from code review
Mar 3, 2021
465632c
Update frame/executive/src/lib.rs
Mar 3, 2021
2c340d5
doc tests in test-runner crate
Mar 4, 2021
0a05661
Merge branch 'substrate-test-runner' of github.com:paritytech/substra…
Mar 4, 2021
0b22b08
fix import
Mar 4, 2021
b422a05
Merge branch 'master' of github.com:paritytech/substrate into substra…
Mar 8, 2021
ace0295
rename to test-runner-example
Mar 8, 2021
487bf82
remove unneeded test
Mar 8, 2021
edbafae
Apply suggestions from code review
Mar 10, 2021
f7c2358
Update test-utils/test-runner/src/lib.rs
Mar 10, 2021
5d7043f
introduce NodeConfig
Mar 11, 2021
3a8ca65
remove tokio-compat
Mar 11, 2021
9b5ed29
Merge branch 'master' of github.com:paritytech/substrate into substra…
Mar 11, 2021
a821a5a
Merge branch 'master' of github.com:paritytech/substrate into substra…
Mar 16, 2021
b394936
ignore test runner test
Mar 19, 2021
216e1b7
fix doc test
Mar 19, 2021
6101c74
fix test_runner test
shawntabrizi Mar 21, 2021
744a0f8
Merge branch 'master' into substrate-test-runner
shawntabrizi Mar 21, 2021
a17dfb4
fix test
Mar 21, 2021
bf51eb4
Merge branch 'substrate-test-runner' of github.com:paritytech/substra…
Mar 21, 2021
e741136
use Pallet instead
Mar 22, 2021
a9d5900
use no_run
Mar 22, 2021
a417c85
use ignore?
Mar 22, 2021
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
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Kian Paimani <[email protected]>
  • Loading branch information
Seun Lanlege and kianenigma authored Mar 10, 2021
commit edbafaeb5e9d9ef7d7d3726d28920cd2be570011
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
"bin/node/bench",
"bin/node/browser-testing",
"bin/node/cli",
"bin/node/test-runner-example",
"bin/node/test-runner-example",
"bin/node/executor",
"bin/node/primitives",
"bin/node/rpc",
Expand Down
11 changes: 5 additions & 6 deletions bin/node/test-runner-example/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of Substrate.

// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -231,7 +231,7 @@ impl ChainInfo for NodeTemplateChainInfo {

fn dispatch_with_root(call: <Self::Runtime as frame_system::Config>::Call, node: &mut Node<Self>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work in any chain without sudo. At least, you should provide the same example in polkadot as well.

let alice = MultiSigner::from(Alice.public()).into_account();
let call = pallet_sudo::Call::sudo(Box::new(call)); // :D
let call = pallet_sudo::Call::sudo(Box::new(call));
node.submit_extrinsic(call, alice);
node.seal_blocks(1);
}
Expand All @@ -240,7 +240,6 @@ impl ChainInfo for NodeTemplateChainInfo {
#[cfg(test)]
mod tests {
use super::*;
use frame_system::{Call, Pallet};

#[test]
fn test_runner() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good showcase 👍

Expand All @@ -249,10 +248,10 @@ mod tests {
node.seal_blocks(1);
// submit extrinsics
let alice = MultiSigner::from(Alice.public()).into_account();
node.submit_extrinsic(Call::remark((b"hello world").to_vec()), alice);
node.submit_extrinsic(frame_system::Call::remark((b"hello world").to_vec()), alice);

// look ma, i can read state
let _events = node.with_state(|| Pallet::<node_runtime::Runtime>::events());
// look ma, I can read state.
let _events = node.with_state(|| frame_system::Pallet::<node_runtime::Runtime>::events());
// get access to the underlying client.
let _client = node.client();
}
Expand Down
2 changes: 1 addition & 1 deletion test-utils/test-runner/src/host_functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of Substrate.

// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
Expand Down
12 changes: 6 additions & 6 deletions test-utils/test-runner/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of Substrate.

// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -84,7 +84,7 @@ pub struct Node<T: ChainInfo> {
type EventRecord<T> = frame_system::EventRecord<<T as frame_system::Config>::Event, <T as frame_system::Config>::Hash>;

impl<T: ChainInfo> Node<T> {
/// Starts a node with the manual-seal authorship,
/// Starts a node with the manual-seal authorship.
pub fn new() -> Result<Self, sc_service::Error>
where
<T::RuntimeApi as ConstructRuntimeApi<T::Block, TFullClient<T::Block, T::RuntimeApi, T::Executor>>>::RuntimeApi:
Expand Down Expand Up @@ -345,7 +345,7 @@ impl<T: ChainInfo> Node<T> {
}
}

/// Create a new jsonrpc client using the jsonrpc-core-client local transport
/// Create a new jsonrpc client using the jsonrpc-core-client local transport.
pub fn rpc_client<C>(&self) -> C
where
C: From<RpcChannel> + 'static,
Expand All @@ -357,12 +357,12 @@ impl<T: ChainInfo> Node<T> {
client
}

/// Revert count number of blocks from the chain
/// Revert count number of blocks from the chain.
pub fn revert_blocks(&self, count: NumberFor<T::Block>) {
self.backend.revert(count, true).expect("Failed to revert blocks: ");
}

/// Revert all blocks added since creation of the node
/// Revert all blocks added since creation of the node.
pub fn clean(&self) {
// if a db path was specified, revert all blocks we've added
if let Some(_) = base_path() {
Expand All @@ -371,7 +371,7 @@ impl<T: ChainInfo> Node<T> {
}
}

/// Performs a runtime upgrade given a wasm blob
/// Performs a runtime upgrade given a wasm blob.
pub fn upgrade_runtime(&mut self, wasm: Vec<u8>)
where
<T::Runtime as frame_system::Config>::Call: From<frame_system::Call<T::Runtime>>
Expand Down