Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
655dc45
Initial commit
cecton May 6, 2020
9a47c09
Added subcommand to run polkadot
cecton May 6, 2020
32e81cf
Add command validation-worker
cecton May 6, 2020
df0f832
Add storage_append to runtime
cecton May 6, 2020
892d057
WIP
cecton May 7, 2020
41f50ee
WIP
cecton May 8, 2020
214e50d
WIP
cecton May 8, 2020
cd131ff
WIP
cecton May 11, 2020
3212554
clean exit if possible
cecton May 11, 2020
0286a88
wip
cecton May 11, 2020
d38edea
WIP
cecton May 11, 2020
3d162e0
WIP
cecton May 11, 2020
62b544e
WIP
cecton May 11, 2020
17887fc
.editorconfig
cecton May 12, 2020
a0eb356
register working
cecton May 12, 2020
9961be4
WIP
cecton May 12, 2020
baa4357
clean-up
cecton May 13, 2020
fc408e4
Rename ProcessCleanUp to ChildHelper
cecton May 13, 2020
22b64de
More clean-up
cecton May 13, 2020
a978970
Runs integration test separately
cecton May 13, 2020
ee3832a
Merge commit 3acb6d0d835c3589f50bf0911729baaea41981fc (no conflict)
cecton May 13, 2020
1267f80
Merge commit c163d8702b27e542caebd0df585d45ec761edc2a (conflicts)
cecton May 13, 2020
368a582
Simplify toml
cecton May 13, 2020
de2b666
Merge commit e810cf3b5ba4b6b1a2848bc57a6302146fc54d78 (conflicts)
cecton May 13, 2020
a17dd34
Merge commit d6ab13c00f555674212b0c86620fdb504d8cf505 (no conflict)
cecton May 13, 2020
31768ce
Initial commit
cecton May 13, 2020
68b0dcf
Update substrate & polkadot branch
cecton May 13, 2020
e2f3fdc
Update test/parachain/tests/integration_test.rs
cecton May 13, 2020
0361e14
Split polkadot service creation from service building/running
cecton May 13, 2020
cde8935
Applied suggestions
cecton May 13, 2020
145ec00
Renamed _child to _helper
cecton May 13, 2020
0d21e75
Use JustifiedBlockAnnounceValidator
cecton May 13, 2020
671d5f9
Update test/parachain/tests/integration_test.rs
cecton May 14, 2020
a5c89b0
Make a function for generate_genesis_state
cecton May 14, 2020
9697b62
Move std::io::Read import
cecton May 14, 2020
a300ea9
wait_for_tcp indefinitely + remove 10s wait for relay blocks
cecton May 14, 2020
87489c5
Implement max time allowed for the test
cecton May 14, 2020
6f0075a
rpc call to monitor new blocks
cecton May 14, 2020
9c7af42
Removed unused helpers
cecton May 14, 2020
19b7942
Update test/parachain/tests/integration_test.rs
cecton May 14, 2020
6eca4f0
Not sure why I made a helper for this in the first place...
cecton May 15, 2020
6e43fd4
WIP
cecton May 15, 2020
2564cce
cleanup
cecton May 15, 2020
542eb35
CLEANUP
cecton May 15, 2020
ddb111f
Merge branch 'cecton-int-test' into cecton-use-custom-block-announce-…
cecton May 15, 2020
d985af8
WIP
cecton May 15, 2020
e4fb6aa
Apply suggestions
cecton May 15, 2020
bf68f24
Fix p2p ports
cecton May 15, 2020
8c24090
Merge branch 'cecton-int-test' into cecton-use-custom-block-announce-…
cecton May 18, 2020
a633fdd
Add test in int test scenario
cecton May 18, 2020
865542d
CLEANUP
cecton May 18, 2020
56929d6
CLEANUP
cecton May 18, 2020
0b1f21b
Merge commit e183d8bd30514d941586bb9bb6decce322572fca (no conflict)
cecton May 18, 2020
c9f95a3
Merge commit 0a7cde66102efe59f4041e5fe5603eace6443328 (conflicts)
cecton May 18, 2020
e7fe457
Refactor
cecton May 19, 2020
bb89a33
Removes some unwrap & introduce parking_lot
cecton May 19, 2020
9cc6f21
Replace match by expect
cecton May 19, 2020
5a257d6
Update network/src/lib.rs
cecton May 19, 2020
934fd5c
Add doc
cecton May 19, 2020
21dba8c
Reduce comment
cecton May 19, 2020
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
  • Loading branch information
cecton committed May 15, 2020
commit e4fb6aacabaa67fe6a116f6929c79eb4e6bc25a3
46 changes: 28 additions & 18 deletions test/parachain/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#![allow(unused_variables, dead_code)]

use assert_cmd::cargo::cargo_bin;
use async_std::task::sleep;
use async_std::{net, task::sleep};
use codec::Encode;
use futures::{future::FutureExt, pin_mut, select};
use futures::{future::FutureExt, join, pin_mut, select};
use polkadot_primitives::parachain::{Info, Scheduling};
use polkadot_primitives::Hash as PHash;
use polkadot_runtime::{Header, OnlyStakingAndClaims, Runtime, SignedExtra, SignedPayload};
Expand All @@ -29,12 +29,11 @@ use serde_json::Value;
use sp_arithmetic::traits::SaturatedConversion;
use sp_runtime::generic;
use sp_version::RuntimeVersion;
use std::collections::HashSet;
use std::{
collections::HashSet,
convert::TryInto,
env, fs,
io::Read,
net,
path::PathBuf,
process::{Child, Command, Stdio},
thread,
Expand All @@ -44,6 +43,7 @@ use substrate_test_runtime_client::AccountKeyring::Alice;
use tempfile::tempdir;

static POLKADOT_ARGS: &[&str] = &["polkadot", "--chain=res/polkadot_chainspec.json"];
static INTEGRATION_TEST_ALLOWED_TIME: Option<&str> = option_env!("INTEGRATION_TEST_ALLOWED_TIME");

jsonrpsee::rpc_api! {
Author {
Expand Down Expand Up @@ -169,7 +169,7 @@ impl<'a> ChildHelper<'a> {
}

async fn wait_for_tcp<A: net::ToSocketAddrs + std::fmt::Display>(address: A) {
while let Err(err) = net::TcpStream::connect(&address) {
while let Err(err) = net::TcpStream::connect(&address).await {
eprintln!("Waiting for {} to be up ({})...", address, err);
sleep(Duration::from_secs(2)).await;
}
Expand All @@ -179,15 +179,20 @@ async fn wait_for_tcp<A: net::ToSocketAddrs + std::fmt::Display>(address: A) {
#[ignore]
async fn integration_test() {
assert!(
!net::TcpStream::connect("127.0.0.1:9933").is_ok(),
"tcp port is already open 127.0.0.1:9933, this test cannot be run",
!net::TcpStream::connect("127.0.0.1:27015").await.is_ok(),
"tcp port is already open 127.0.0.1:27015, this test cannot be run",
);
assert!(
!net::TcpStream::connect("127.0.0.1:9934").is_ok(),
"tcp port is already open 127.0.0.1:9934, this test cannot be run",
!net::TcpStream::connect("127.0.0.1:27016").await.is_ok(),
"tcp port is already open 127.0.0.1:27016, this test cannot be run",
);

let t1 = sleep(Duration::from_secs(60 * 10)).fuse();
let t1 = sleep(Duration::from_secs(
INTEGRATION_TEST_ALLOWED_TIME
.and_then(|x| x.parse().ok())
.unwrap_or(600),
))
.fuse();
let t2 = async {
// start alice
let polkadot_alice_dir = tempdir().unwrap();
Expand All @@ -199,10 +204,10 @@ async fn integration_test() {
.arg(polkadot_alice_dir.path())
.arg("--alice")
.arg("--unsafe-rpc-expose")
.arg("--rpc-port=27015")
.spawn()
.unwrap();
let polkadot_alice_helper = ChildHelper::new("alice", &mut polkadot_alice);
wait_for_tcp("127.0.0.1:9933").await;

// start bob
let polkadot_bob_dir = tempdir().unwrap();
Expand All @@ -214,11 +219,16 @@ async fn integration_test() {
.arg(polkadot_bob_dir.path())
.arg("--bob")
.arg("--unsafe-rpc-expose")
.arg("--rpc-port=9934")
.arg("--rpc-port=27016")
.spawn()
.unwrap();
let polkadot_bob_helper = ChildHelper::new("bob", &mut polkadot_bob);
wait_for_tcp("127.0.0.1:9934").await;

// wait for both nodes to be up and running
join!(
wait_for_tcp("127.0.0.1:27015"),
wait_for_tcp("127.0.0.1:27016")
);

// export genesis state
let cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
Expand All @@ -231,10 +241,10 @@ async fn integration_test() {

// connect RPC clients
let transport_client_alice =
jsonrpsee::transport::http::HttpTransportClient::new("http://127.0.0.1:9933");
jsonrpsee::transport::http::HttpTransportClient::new("http://127.0.0.1:27015");
let mut client_alice = jsonrpsee::raw::RawClient::new(transport_client_alice);
let transport_client_bob =
jsonrpsee::transport::http::HttpTransportClient::new("http://127.0.0.1:9934");
jsonrpsee::transport::http::HttpTransportClient::new("http://127.0.0.1:27016");
let mut client_bob = jsonrpsee::raw::RawClient::new(transport_client_bob);

// retrieve nodes network id
Expand Down Expand Up @@ -337,7 +347,7 @@ async fn integration_test() {
.arg("--base-path")
.arg(cumulus_dir.path())
.arg("--unsafe-rpc-expose")
.arg("--rpc-port=9935")
.arg("--rpc-port=27017")
.arg("--")
.arg(format!(
"--bootnodes=/ip4/127.0.0.1/tcp/30333/p2p/{}",
Expand All @@ -350,11 +360,11 @@ async fn integration_test() {
.spawn()
.unwrap();
let cumulus_helper = ChildHelper::new("cumulus", &mut cumulus);
wait_for_tcp("127.0.0.1:9935").await;
wait_for_tcp("127.0.0.1:27017").await;

// connect rpc client to cumulus
let transport_client_cumulus =
jsonrpsee::transport::http::HttpTransportClient::new("http://127.0.0.1:9935");
jsonrpsee::transport::http::HttpTransportClient::new("http://127.0.0.1:27017");
let mut client_cumulus = jsonrpsee::raw::RawClient::new(transport_client_cumulus);

// wait for parachain blocks to be produced
Expand Down