mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Upgrade tokio to 1.10 (#9575)
* Upgrade tokio to 1.10 * Fix test runner * Try fix it * Update Cargo.lock * Review feedback * ahhhh * FML * FMT * Fix tests
This commit is contained in:
Generated
+36
-258
@@ -1202,17 +1202,6 @@ dependencies = [
|
||||
"crossbeam-utils 0.8.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
|
||||
dependencies = [
|
||||
"crossbeam-epoch 0.8.2",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.0"
|
||||
@@ -1220,25 +1209,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-epoch 0.9.3",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils 0.8.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"cfg-if 0.1.10",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"lazy_static",
|
||||
"maybe-uninit",
|
||||
"memoffset 0.5.6",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.3"
|
||||
@@ -1248,21 +1222,10 @@ dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-utils 0.8.3",
|
||||
"lazy_static",
|
||||
"memoffset 0.6.1",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.7.2"
|
||||
@@ -2682,7 +2645,7 @@ dependencies = [
|
||||
"itoa",
|
||||
"pin-project-lite 0.2.6",
|
||||
"socket2 0.4.0",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
@@ -2700,8 +2663,8 @@ dependencies = [
|
||||
"log 0.4.14",
|
||||
"rustls",
|
||||
"rustls-native-certs",
|
||||
"tokio 1.10.0",
|
||||
"tokio-rustls 0.22.0",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
@@ -2714,7 +2677,7 @@ dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"hyper 0.14.11",
|
||||
"native-tls",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
]
|
||||
|
||||
@@ -2941,7 +2904,7 @@ dependencies = [
|
||||
"log 0.4.14",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
"url 1.7.2",
|
||||
"websocket",
|
||||
]
|
||||
@@ -3041,9 +3004,9 @@ dependencies = [
|
||||
"jsonrpc-core",
|
||||
"lazy_static",
|
||||
"log 0.4.14",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-util 0.6.7",
|
||||
"tokio-util",
|
||||
"unicase 2.6.0",
|
||||
]
|
||||
|
||||
@@ -3112,9 +3075,9 @@ dependencies = [
|
||||
"serde_json",
|
||||
"soketto 0.6.0",
|
||||
"thiserror",
|
||||
"tokio 0.2.25",
|
||||
"tokio-rustls 0.15.0",
|
||||
"tokio-util 0.3.1",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-util",
|
||||
"url 2.2.1",
|
||||
]
|
||||
|
||||
@@ -3977,15 +3940,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.6.1"
|
||||
@@ -4107,17 +4061,6 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio-uds"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
|
||||
dependencies = [
|
||||
"iovec",
|
||||
"libc",
|
||||
"mio 0.6.23",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.2.2"
|
||||
@@ -5968,7 +5911,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log 0.4.14",
|
||||
"rand 0.7.3",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
@@ -6963,7 +6906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"crossbeam-deque 0.8.0",
|
||||
"crossbeam-deque",
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
@@ -6975,7 +6918,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque 0.8.0",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils 0.8.3",
|
||||
"lazy_static",
|
||||
"num_cpus",
|
||||
@@ -7103,7 +7046,7 @@ dependencies = [
|
||||
"sp-io",
|
||||
"sp-runtime",
|
||||
"sp-version",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7433,7 +7376,7 @@ dependencies = [
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tiny-bip39",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7681,7 +7624,7 @@ dependencies = [
|
||||
"substrate-prometheus-endpoint",
|
||||
"substrate-test-runtime-client",
|
||||
"substrate-test-runtime-transaction-pool",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7875,7 +7818,7 @@ dependencies = [
|
||||
"substrate-prometheus-endpoint",
|
||||
"substrate-test-runtime-client",
|
||||
"tempfile",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8087,7 +8030,7 @@ dependencies = [
|
||||
"sp-utils",
|
||||
"substrate-test-runtime-client",
|
||||
"threadpool",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8262,7 +8205,7 @@ dependencies = [
|
||||
"substrate-test-runtime-client",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-futures",
|
||||
]
|
||||
@@ -8272,7 +8215,6 @@ name = "sc-service-test"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"fdlimit",
|
||||
"futures 0.1.31",
|
||||
"futures 0.3.16",
|
||||
"hex-literal",
|
||||
"log 0.4.14",
|
||||
@@ -8301,7 +8243,7 @@ dependencies = [
|
||||
"substrate-test-runtime",
|
||||
"substrate-test-runtime-client",
|
||||
"tempfile",
|
||||
"tokio 0.1.22",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9789,7 +9731,7 @@ dependencies = [
|
||||
"sc-rpc-api",
|
||||
"serde",
|
||||
"sp-storage",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9826,7 +9768,7 @@ dependencies = [
|
||||
"hyper 0.14.11",
|
||||
"log 0.4.14",
|
||||
"prometheus",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9941,7 +9883,7 @@ dependencies = [
|
||||
"futures 0.3.16",
|
||||
"sc-service",
|
||||
"substrate-test-utils-derive",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
"trybuild",
|
||||
]
|
||||
|
||||
@@ -9950,6 +9892,7 @@ name = "substrate-test-utils-derive"
|
||||
version = "0.10.0-dev"
|
||||
dependencies = [
|
||||
"proc-macro-crate 1.0.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
@@ -9960,7 +9903,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"sc-service",
|
||||
"substrate-test-utils",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -10105,7 +10048,7 @@ dependencies = [
|
||||
"sp-state-machine",
|
||||
"sp-transaction-pool",
|
||||
"sp-wasm-interface",
|
||||
"tokio 0.2.25",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -10240,51 +10183,6 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures 0.1.31",
|
||||
"mio 0.6.23",
|
||||
"num_cpus",
|
||||
"tokio-codec",
|
||||
"tokio-current-thread",
|
||||
"tokio-executor",
|
||||
"tokio-fs",
|
||||
"tokio-io",
|
||||
"tokio-reactor",
|
||||
"tokio-sync",
|
||||
"tokio-tcp",
|
||||
"tokio-threadpool",
|
||||
"tokio-timer",
|
||||
"tokio-udp",
|
||||
"tokio-uds",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "0.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092"
|
||||
dependencies = [
|
||||
"bytes 0.5.6",
|
||||
"fnv",
|
||||
"iovec",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"mio 0.6.23",
|
||||
"mio-uds",
|
||||
"num_cpus",
|
||||
"pin-project-lite 0.1.12",
|
||||
"signal-hook-registry",
|
||||
"slab",
|
||||
"tokio-macros 0.2.6",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.10.0"
|
||||
@@ -10301,7 +10199,7 @@ dependencies = [
|
||||
"parking_lot 0.11.1",
|
||||
"pin-project-lite 0.2.6",
|
||||
"signal-hook-registry",
|
||||
"tokio-macros 1.3.0",
|
||||
"tokio-macros",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
@@ -10316,16 +10214,6 @@ dependencies = [
|
||||
"tokio-io",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-current-thread"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e"
|
||||
dependencies = [
|
||||
"futures 0.1.31",
|
||||
"tokio-executor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-executor"
|
||||
version = "0.1.10"
|
||||
@@ -10336,17 +10224,6 @@ dependencies = [
|
||||
"futures 0.1.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-fs"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4"
|
||||
dependencies = [
|
||||
"futures 0.1.31",
|
||||
"tokio-io",
|
||||
"tokio-threadpool",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-io"
|
||||
version = "0.1.13"
|
||||
@@ -10358,17 +10235,6 @@ dependencies = [
|
||||
"log 0.4.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "1.3.0"
|
||||
@@ -10387,7 +10253,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
|
||||
dependencies = [
|
||||
"native-tls",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -10409,18 +10275,6 @@ dependencies = [
|
||||
"tokio-sync",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03d15e5669243a45f630a5167d101b942174ca94b615445b2057eace1c818736"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"rustls",
|
||||
"tokio 0.2.25",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.22.0"
|
||||
@@ -10428,7 +10282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
|
||||
dependencies = [
|
||||
"rustls",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
@@ -10440,7 +10294,7 @@ checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite 0.2.6",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -10467,35 +10321,6 @@ dependencies = [
|
||||
"tokio-reactor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-threadpool"
|
||||
version = "0.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89"
|
||||
dependencies = [
|
||||
"crossbeam-deque 0.7.3",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"futures 0.1.31",
|
||||
"lazy_static",
|
||||
"log 0.4.14",
|
||||
"num_cpus",
|
||||
"slab",
|
||||
"tokio-executor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-timer"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.7.2",
|
||||
"futures 0.1.31",
|
||||
"slab",
|
||||
"tokio-executor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-tls"
|
||||
version = "0.2.1"
|
||||
@@ -10507,54 +10332,6 @@ dependencies = [
|
||||
"tokio-io",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-udp"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures 0.1.31",
|
||||
"log 0.4.14",
|
||||
"mio 0.6.23",
|
||||
"tokio-codec",
|
||||
"tokio-io",
|
||||
"tokio-reactor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-uds"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures 0.1.31",
|
||||
"iovec",
|
||||
"libc",
|
||||
"log 0.4.14",
|
||||
"mio 0.6.23",
|
||||
"mio-uds",
|
||||
"tokio-codec",
|
||||
"tokio-io",
|
||||
"tokio-reactor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
|
||||
dependencies = [
|
||||
"bytes 0.5.6",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"log 0.4.14",
|
||||
"pin-project-lite 0.1.12",
|
||||
"tokio 0.2.25",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.6.7"
|
||||
@@ -10563,10 +10340,11 @@ checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592"
|
||||
dependencies = [
|
||||
"bytes 1.0.1",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"log 0.4.14",
|
||||
"pin-project-lite 0.2.6",
|
||||
"tokio 1.10.0",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11345,7 +11123,7 @@ dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"indexmap",
|
||||
"libc",
|
||||
"memoffset 0.6.1",
|
||||
"memoffset",
|
||||
"more-asserts",
|
||||
"region",
|
||||
"serde",
|
||||
@@ -11571,7 +11349,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log 0.4.14",
|
||||
"mach",
|
||||
"memoffset 0.6.1",
|
||||
"memoffset",
|
||||
"more-asserts",
|
||||
"rand 0.8.4",
|
||||
"region",
|
||||
|
||||
@@ -227,7 +227,6 @@ cranelift-codegen = { opt-level = 3 }
|
||||
cranelift-wasm = { opt-level = 3 }
|
||||
crc32fast = { opt-level = 3 }
|
||||
crossbeam-deque = { opt-level = 3 }
|
||||
crossbeam-queue = { opt-level = 3 }
|
||||
crypto-mac = { opt-level = 3 }
|
||||
curve25519-dalek = { opt-level = 3 }
|
||||
ed25519-dalek = { opt-level = 3 }
|
||||
|
||||
@@ -113,7 +113,7 @@ sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/commo
|
||||
sc-consensus-babe = { version = "0.10.0-dev", path = "../../../client/consensus/babe" }
|
||||
sc-consensus-epochs = { version = "0.10.0-dev", path = "../../../client/consensus/epochs" }
|
||||
sc-service-test = { version = "2.0.0", path = "../../../client/service/test" }
|
||||
futures = "0.3.9"
|
||||
futures = "0.3.16"
|
||||
tempfile = "3.1.0"
|
||||
assert_cmd = "1.0"
|
||||
nix = "0.19"
|
||||
@@ -130,12 +130,7 @@ frame-benchmarking-cli = { version = "4.0.0-dev", optional = true, path = "../..
|
||||
substrate-build-script-utils = { version = "3.0.0", optional = true, path = "../../../utils/build-script-utils" }
|
||||
substrate-frame-cli = { version = "4.0.0-dev", optional = true, path = "../../../utils/frame/frame-utilities-cli" }
|
||||
try-runtime-cli = { version = "0.10.0-dev", optional = true, path = "../../../utils/frame/try-runtime/cli" }
|
||||
|
||||
[build-dependencies.sc-cli]
|
||||
version = "0.10.0-dev"
|
||||
package = "sc-cli"
|
||||
path = "../../../client/cli"
|
||||
optional = true
|
||||
sc-cli = { version = "0.10.0-dev", path = "../../../client/cli", optional = true }
|
||||
|
||||
[features]
|
||||
default = [ "cli" ]
|
||||
|
||||
@@ -92,7 +92,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_runner() {
|
||||
let mut tokio_runtime = build_runtime().unwrap();
|
||||
let tokio_runtime = build_runtime().unwrap();
|
||||
let task_executor = task_executor(tokio_runtime.handle().clone());
|
||||
let (rpc, task_manager, client, pool, command_sink, backend) = client_parts::<
|
||||
NodeTemplateChainInfo,
|
||||
|
||||
@@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
log = "0.4.11"
|
||||
regex = "1.4.2"
|
||||
tokio = { version = "0.2.21", features = [ "signal", "rt-core", "rt-threaded", "blocking" ] }
|
||||
tokio = { version = "1.10", features = [ "signal", "rt-multi-thread" ] }
|
||||
futures = "0.3.9"
|
||||
fdlimit = "0.2.1"
|
||||
libp2p = "0.39.1"
|
||||
|
||||
@@ -73,8 +73,7 @@ where
|
||||
|
||||
/// Build a tokio runtime with all features
|
||||
pub fn build_runtime() -> std::result::Result<tokio::runtime::Runtime, std::io::Error> {
|
||||
tokio::runtime::Builder::new()
|
||||
.threaded_scheduler()
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.on_thread_start(|| {
|
||||
TOKIO_THREADS_ALIVE.inc();
|
||||
TOKIO_THREADS_TOTAL.inc();
|
||||
@@ -87,7 +86,7 @@ pub fn build_runtime() -> std::result::Result<tokio::runtime::Runtime, std::io::
|
||||
}
|
||||
|
||||
fn run_until_exit<F, E>(
|
||||
mut tokio_runtime: tokio::runtime::Runtime,
|
||||
tokio_runtime: tokio::runtime::Runtime,
|
||||
future: F,
|
||||
task_manager: TaskManager,
|
||||
) -> std::result::Result<(), E>
|
||||
@@ -152,7 +151,7 @@ impl<C: SubstrateCli> Runner<C> {
|
||||
/// A helper function that runs a node with tokio and stops if the process receives the signal
|
||||
/// `SIGTERM` or `SIGINT`.
|
||||
pub fn run_node_until_exit<F, E>(
|
||||
mut self,
|
||||
self,
|
||||
initialize: impl FnOnce(Configuration) -> F,
|
||||
) -> std::result::Result<(), E>
|
||||
where
|
||||
|
||||
@@ -45,7 +45,7 @@ sp-timestamp = { path = "../../../primitives/timestamp", version = "4.0.0-dev" }
|
||||
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.9.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "0.2", features = ["rt-core", "macros"] }
|
||||
tokio = { version = "1.10.0", features = ["rt-multi-thread", "macros"] }
|
||||
sc-basic-authorship = { path = "../../basic-authorship", version = "0.10.0-dev" }
|
||||
substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0" }
|
||||
substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0" }
|
||||
|
||||
@@ -308,7 +308,7 @@ mod tests {
|
||||
consensus_data_provider: None,
|
||||
});
|
||||
std::thread::spawn(|| {
|
||||
let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
// spawn the background authorship task
|
||||
rt.block_on(future);
|
||||
});
|
||||
@@ -365,7 +365,7 @@ mod tests {
|
||||
create_inherent_data_providers: |_, _| async { Ok(()) },
|
||||
});
|
||||
std::thread::spawn(|| {
|
||||
let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
// spawn the background authorship task
|
||||
rt.block_on(future);
|
||||
});
|
||||
@@ -443,7 +443,7 @@ mod tests {
|
||||
create_inherent_data_providers: |_, _| async { Ok(()) },
|
||||
});
|
||||
std::thread::spawn(|| {
|
||||
let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
// spawn the background authorship task
|
||||
rt.block_on(future);
|
||||
});
|
||||
|
||||
@@ -57,5 +57,5 @@ sc-network-test = { version = "0.8.0", path = "../network/test" }
|
||||
sp-keyring = { version = "4.0.0-dev", path = "../../primitives/keyring" }
|
||||
substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" }
|
||||
sp-tracing = { version = "4.0.0-dev", path = "../../primitives/tracing" }
|
||||
tokio = { version = "0.2", features = ["rt-core"] }
|
||||
tokio = "1.10"
|
||||
tempfile = "3.1.0"
|
||||
|
||||
@@ -1244,7 +1244,7 @@ fn finalize_3_voters_1_light_observer() {
|
||||
#[test]
|
||||
fn voter_catches_up_to_latest_round_when_behind() {
|
||||
sp_tracing::try_init_simple();
|
||||
let mut runtime = Runtime::new().unwrap();
|
||||
let runtime = Runtime::new().unwrap();
|
||||
|
||||
let peers = &[Ed25519Keyring::Alice, Ed25519Keyring::Bob];
|
||||
let voters = make_ids(peers);
|
||||
|
||||
@@ -87,5 +87,5 @@ directories = "3.0.2"
|
||||
[dev-dependencies]
|
||||
substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" }
|
||||
substrate-test-runtime = { version = "2.0.0", path = "../../test-utils/runtime/" }
|
||||
tokio = { version = "0.2.25", default-features = false }
|
||||
tokio = { version = "1.10", features = ["time"] }
|
||||
async-std = { version = "1.6.5", default-features = false }
|
||||
|
||||
@@ -304,8 +304,8 @@ async fn build_network_future<
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "unknown"))]
|
||||
// Wrapper for HTTP and WS servers that makes sure they are properly shut down.
|
||||
#[cfg(not(target_os = "unknown"))]
|
||||
mod waiting {
|
||||
pub struct HttpServer(pub Option<sc_rpc_server::HttpServer>);
|
||||
impl Drop for HttpServer {
|
||||
|
||||
@@ -311,7 +311,13 @@ impl TaskManager {
|
||||
Box::pin(async move {
|
||||
join_all(children_shutdowns).await;
|
||||
completion_future.await;
|
||||
drop(keep_alive);
|
||||
|
||||
// The keep_alive stuff is holding references to some RPC handles etc. These
|
||||
// RPC handles spawn their own tokio stuff and that doesn't like to be closed in an
|
||||
// async context. So, we move the deletion to some other thread.
|
||||
std::thread::spawn(move || {
|
||||
let _ = keep_alive;
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@ impl DropTester {
|
||||
*self.0.lock() += 1;
|
||||
DropTesterRef(self.clone())
|
||||
}
|
||||
|
||||
fn wait_on_drop(&self) {
|
||||
while *self != 0 {
|
||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<usize> for DropTester {
|
||||
@@ -65,7 +71,7 @@ fn ensure_drop_tester_working() {
|
||||
|
||||
async fn run_background_task(_keep_alive: impl Any) {
|
||||
loop {
|
||||
tokio::time::delay_for(Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +80,7 @@ async fn run_background_task_blocking(duration: Duration, _keep_alive: impl Any)
|
||||
// block for X sec (not interruptible)
|
||||
std::thread::sleep(duration);
|
||||
// await for 1 sec (interruptible)
|
||||
tokio::time::delay_for(Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +90,7 @@ fn new_task_manager(task_executor: TaskExecutor) -> TaskManager {
|
||||
|
||||
#[test]
|
||||
fn ensure_tasks_are_awaited_on_shutdown() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -95,15 +101,15 @@ fn ensure_tasks_are_awaited_on_shutdown() {
|
||||
spawn_handle.spawn("task2", run_background_task(drop_tester.new_ref()));
|
||||
assert_eq!(drop_tester, 2);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 2);
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
drop_tester.wait_on_drop();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_keep_alive_during_shutdown() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -114,15 +120,15 @@ fn ensure_keep_alive_during_shutdown() {
|
||||
spawn_handle.spawn("task1", run_background_task(()));
|
||||
assert_eq!(drop_tester, 1);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 1);
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
drop_tester.wait_on_drop();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_blocking_futures_are_awaited_on_shutdown() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -139,7 +145,7 @@ fn ensure_blocking_futures_are_awaited_on_shutdown() {
|
||||
);
|
||||
assert_eq!(drop_tester, 2);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 2);
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
@@ -147,7 +153,7 @@ fn ensure_blocking_futures_are_awaited_on_shutdown() {
|
||||
|
||||
#[test]
|
||||
fn ensure_no_task_can_be_spawn_after_terminate() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -158,17 +164,17 @@ fn ensure_no_task_can_be_spawn_after_terminate() {
|
||||
spawn_handle.spawn("task2", run_background_task(drop_tester.new_ref()));
|
||||
assert_eq!(drop_tester, 2);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 2);
|
||||
task_manager.terminate();
|
||||
spawn_handle.spawn("task3", run_background_task(drop_tester.new_ref()));
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
drop_tester.wait_on_drop();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_task_manager_future_ends_when_task_manager_terminated() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -179,7 +185,7 @@ fn ensure_task_manager_future_ends_when_task_manager_terminated() {
|
||||
spawn_handle.spawn("task2", run_background_task(drop_tester.new_ref()));
|
||||
assert_eq!(drop_tester, 2);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 2);
|
||||
task_manager.terminate();
|
||||
runtime.block_on(task_manager.future()).expect("future has ended without error");
|
||||
@@ -189,7 +195,7 @@ fn ensure_task_manager_future_ends_when_task_manager_terminated() {
|
||||
|
||||
#[test]
|
||||
fn ensure_task_manager_future_ends_with_error_when_essential_task_fails() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -201,7 +207,7 @@ fn ensure_task_manager_future_ends_with_error_when_essential_task_fails() {
|
||||
spawn_handle.spawn("task2", run_background_task(drop_tester.new_ref()));
|
||||
assert_eq!(drop_tester, 2);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 2);
|
||||
spawn_essential_handle.spawn("task3", async { panic!("task failed") });
|
||||
runtime
|
||||
@@ -209,12 +215,12 @@ fn ensure_task_manager_future_ends_with_error_when_essential_task_fails() {
|
||||
.expect_err("future()'s Result must be Err");
|
||||
assert_eq!(drop_tester, 2);
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
drop_tester.wait_on_drop();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_children_tasks_ends_when_task_manager_terminated() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -233,17 +239,17 @@ fn ensure_children_tasks_ends_when_task_manager_terminated() {
|
||||
spawn_handle_child_2.spawn("task4", run_background_task(drop_tester.new_ref()));
|
||||
assert_eq!(drop_tester, 4);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 4);
|
||||
task_manager.terminate();
|
||||
runtime.block_on(task_manager.future()).expect("future has ended without error");
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
drop_tester.wait_on_drop();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_task_manager_future_ends_with_error_when_childs_essential_task_fails() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -263,7 +269,7 @@ fn ensure_task_manager_future_ends_with_error_when_childs_essential_task_fails()
|
||||
spawn_handle_child_2.spawn("task4", run_background_task(drop_tester.new_ref()));
|
||||
assert_eq!(drop_tester, 4);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 4);
|
||||
spawn_essential_handle_child_1.spawn("task5", async { panic!("task failed") });
|
||||
runtime
|
||||
@@ -271,12 +277,12 @@ fn ensure_task_manager_future_ends_with_error_when_childs_essential_task_fails()
|
||||
.expect_err("future()'s Result must be Err");
|
||||
assert_eq!(drop_tester, 4);
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
drop_tester.wait_on_drop();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_task_manager_future_continues_when_childs_not_essential_task_fails() {
|
||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let handle = runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = (move |future, _| handle.spawn(future).map(|_| ())).into();
|
||||
|
||||
@@ -295,12 +301,12 @@ fn ensure_task_manager_future_continues_when_childs_not_essential_task_fails() {
|
||||
spawn_handle_child_2.spawn("task4", run_background_task(drop_tester.new_ref()));
|
||||
assert_eq!(drop_tester, 4);
|
||||
// allow the tasks to even start
|
||||
runtime.block_on(async { tokio::time::delay_for(Duration::from_secs(1)).await });
|
||||
runtime.block_on(async { tokio::time::sleep(Duration::from_secs(1)).await });
|
||||
assert_eq!(drop_tester, 4);
|
||||
spawn_handle_child_1.spawn("task5", async { panic!("task failed") });
|
||||
runtime.block_on(async {
|
||||
let t1 = task_manager.future().fuse();
|
||||
let t2 = tokio::time::delay_for(Duration::from_secs(3)).fuse();
|
||||
let t2 = tokio::time::sleep(Duration::from_secs(3)).fuse();
|
||||
|
||||
pin_mut!(t1, t2);
|
||||
|
||||
@@ -311,5 +317,5 @@ fn ensure_task_manager_future_continues_when_childs_not_essential_task_fails() {
|
||||
});
|
||||
assert_eq!(drop_tester, 4);
|
||||
runtime.block_on(task_manager.clean_shutdown());
|
||||
assert_eq!(drop_tester, 0);
|
||||
drop_tester.wait_on_drop();
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
hex-literal = "0.3.1"
|
||||
tempfile = "3.1.0"
|
||||
tokio = "0.1.22"
|
||||
futures01 = { package = "futures", version = "0.1.29" }
|
||||
tokio = { version = "1.10.0", features = ["time"] }
|
||||
log = "0.4.8"
|
||||
fdlimit = "0.2.1"
|
||||
parking_lot = "0.11.1"
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
|
||||
//! Service integration test utils.
|
||||
|
||||
use futures::{FutureExt as _, TryFutureExt as _};
|
||||
use futures01::{Future, Poll, Stream};
|
||||
use futures::{task::Poll, Future, FutureExt, TryFutureExt as _};
|
||||
use log::{debug, info};
|
||||
use parking_lot::Mutex;
|
||||
use sc_client_api::{Backend, CallExecutor};
|
||||
@@ -36,9 +35,9 @@ use sc_service::{
|
||||
use sc_transaction_pool_api::TransactionPool;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
|
||||
use std::{iter, net::Ipv4Addr, pin::Pin, sync::Arc, time::Duration};
|
||||
use std::{iter, net::Ipv4Addr, pin::Pin, sync::Arc, task::Context, time::Duration};
|
||||
use tempfile::TempDir;
|
||||
use tokio::{prelude::FutureExt, runtime::Runtime, timer::Interval};
|
||||
use tokio::{runtime::Runtime, time};
|
||||
|
||||
#[cfg(test)]
|
||||
mod client;
|
||||
@@ -57,7 +56,7 @@ struct TestNet<G, E, F, L, U> {
|
||||
}
|
||||
|
||||
pub trait TestNetNode:
|
||||
Clone + Future<Item = (), Error = sc_service::Error> + Send + 'static
|
||||
Clone + Future<Output = Result<(), sc_service::Error>> + Send + 'static
|
||||
{
|
||||
type Block: BlockT;
|
||||
type Backend: Backend<Self::Block>;
|
||||
@@ -109,11 +108,10 @@ impl<TBl: BlockT, TBackend, TExec, TRtApi, TExPool> Clone
|
||||
impl<TBl: BlockT, TBackend, TExec, TRtApi, TExPool> Future
|
||||
for TestNetComponents<TBl, TBackend, TExec, TRtApi, TExPool>
|
||||
{
|
||||
type Item = ();
|
||||
type Error = sc_service::Error;
|
||||
type Output = Result<(), sc_service::Error>;
|
||||
|
||||
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
||||
futures::compat::Compat::new(&mut self.task_manager.lock().future()).poll()
|
||||
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
|
||||
Pin::new(&mut self.task_manager.lock().future()).poll(cx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,33 +159,36 @@ where
|
||||
{
|
||||
let full_nodes = self.full_nodes.clone();
|
||||
let light_nodes = self.light_nodes.clone();
|
||||
let interval = Interval::new_interval(Duration::from_millis(100))
|
||||
.map_err(|_| ())
|
||||
.for_each(move |_| {
|
||||
let future = async move {
|
||||
let mut interval = time::interval(Duration::from_millis(100));
|
||||
|
||||
loop {
|
||||
interval.tick().await;
|
||||
|
||||
let full_ready = full_nodes
|
||||
.iter()
|
||||
.all(|&(ref id, ref service, _, _)| full_predicate(*id, service));
|
||||
|
||||
if !full_ready {
|
||||
return Ok(())
|
||||
continue
|
||||
}
|
||||
|
||||
let light_ready = light_nodes
|
||||
.iter()
|
||||
.all(|&(ref id, ref service, _)| light_predicate(*id, service));
|
||||
|
||||
if !light_ready {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(())
|
||||
if light_ready {
|
||||
return
|
||||
}
|
||||
})
|
||||
.timeout(MAX_WAIT_TIME);
|
||||
}
|
||||
};
|
||||
|
||||
match self.runtime.block_on(interval) {
|
||||
Ok(()) => unreachable!("interval always fails; qed"),
|
||||
Err(ref err) if err.is_inner() => (),
|
||||
Err(_) => panic!("Waited for too long"),
|
||||
if self
|
||||
.runtime
|
||||
.block_on(async move { time::timeout(MAX_WAIT_TIME, future).await })
|
||||
.is_err()
|
||||
{
|
||||
panic!("Waited for too long");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,11 +307,11 @@ where
|
||||
light: impl Iterator<Item = impl FnOnce(Configuration) -> Result<L, Error>>,
|
||||
authorities: impl Iterator<Item = (String, impl FnOnce(Configuration) -> Result<(F, U), Error>)>,
|
||||
) {
|
||||
let executor = self.runtime.executor();
|
||||
let handle = self.runtime.handle().clone();
|
||||
let task_executor: TaskExecutor = {
|
||||
let executor = executor.clone();
|
||||
let executor = handle.clone();
|
||||
(move |fut: Pin<Box<dyn futures::Future<Output = ()> + Send>>, _| {
|
||||
executor.spawn(fut.unit_error().compat());
|
||||
executor.spawn(fut.unit_error());
|
||||
async {}
|
||||
})
|
||||
.into()
|
||||
@@ -330,7 +331,7 @@ where
|
||||
let (service, user_data) =
|
||||
authority(node_config).expect("Error creating test node service");
|
||||
|
||||
executor.spawn(service.clone().map_err(|_| ()));
|
||||
handle.spawn(service.clone().map_err(|_| ()));
|
||||
let addr = addr
|
||||
.with(multiaddr::Protocol::P2p(service.network().local_peer_id().clone().into()));
|
||||
self.authority_nodes.push((self.nodes, service, user_data, addr));
|
||||
@@ -350,7 +351,7 @@ where
|
||||
let addr = node_config.network.listen_addresses.iter().next().unwrap().clone();
|
||||
let (service, user_data) = full(node_config).expect("Error creating test node service");
|
||||
|
||||
executor.spawn(service.clone().map_err(|_| ()));
|
||||
handle.spawn(service.clone().map_err(|_| ()));
|
||||
let addr = addr
|
||||
.with(multiaddr::Protocol::P2p(service.network().local_peer_id().clone().into()));
|
||||
self.full_nodes.push((self.nodes, service, user_data, addr));
|
||||
@@ -370,7 +371,7 @@ where
|
||||
let addr = node_config.network.listen_addresses.iter().next().unwrap().clone();
|
||||
let service = light(node_config).expect("Error creating test node service");
|
||||
|
||||
executor.spawn(service.clone().map_err(|_| ()));
|
||||
handle.spawn(service.clone().map_err(|_| ()));
|
||||
let addr = addr
|
||||
.with(multiaddr::Protocol::P2p(service.network().local_peer_id().clone().into()));
|
||||
self.light_nodes.push((self.nodes, service, addr));
|
||||
@@ -406,7 +407,7 @@ pub fn connectivity<G, E, Fb, F, Lb, L>(
|
||||
|
||||
{
|
||||
let temp = tempdir_with_prefix("substrate-connectivity-test");
|
||||
let runtime = {
|
||||
{
|
||||
let mut network = TestNet::new(
|
||||
&temp,
|
||||
spec.clone(),
|
||||
@@ -444,12 +445,8 @@ pub fn connectivity<G, E, Fb, F, Lb, L>(
|
||||
connected == expected_light_connections
|
||||
},
|
||||
);
|
||||
|
||||
network.runtime
|
||||
};
|
||||
|
||||
runtime.shutdown_now().wait().expect("Error shutting down runtime");
|
||||
|
||||
temp.close().expect("Error removing temp dir");
|
||||
}
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
futures = "0.3.16"
|
||||
substrate-test-utils-derive = { version = "0.10.0-dev", path = "./derive" }
|
||||
tokio = { version = "0.2.13", features = ["macros", "rt-core", "time"] }
|
||||
tokio = { version = "1.10", features = ["macros", "time"] }
|
||||
|
||||
[dev-dependencies]
|
||||
sc-service = { version = "0.10.0-dev", path = "../client/service" }
|
||||
|
||||
@@ -12,6 +12,7 @@ description = "Substrate test utilities macros"
|
||||
quote = "1.0.6"
|
||||
syn = { version = "1.0.58", features = ["full"] }
|
||||
proc-macro-crate = "1.0.0"
|
||||
proc-macro2 = "1.0.28"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
@@ -22,19 +22,14 @@ use quote::quote;
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn test(args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
impl_test(args, item)
|
||||
}
|
||||
|
||||
fn impl_test(args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let input = syn::parse_macro_input!(item as syn::ItemFn);
|
||||
let args = syn::parse_macro_input!(args as syn::AttributeArgs);
|
||||
|
||||
parse_knobs(input, args).unwrap_or_else(|e| e.to_compile_error().into())
|
||||
parse_knobs(input, args.into()).unwrap_or_else(|e| e.to_compile_error().into())
|
||||
}
|
||||
|
||||
fn parse_knobs(
|
||||
mut input: syn::ItemFn,
|
||||
args: syn::AttributeArgs,
|
||||
args: proc_macro2::TokenStream,
|
||||
) -> Result<TokenStream, syn::Error> {
|
||||
let sig = &mut input.sig;
|
||||
let body = &input.block;
|
||||
@@ -62,7 +57,7 @@ fn parse_knobs(
|
||||
|
||||
let header = {
|
||||
quote! {
|
||||
#[#crate_name::tokio::test(#(#args)*)]
|
||||
#[#crate_name::tokio::test( #args )]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,25 +71,15 @@ fn parse_knobs(
|
||||
#crate_name::tokio::spawn(fut).map(drop)
|
||||
})
|
||||
.into();
|
||||
let timeout_task = #crate_name::tokio::time::delay_for(
|
||||
if #crate_name::tokio::time::timeout(
|
||||
std::time::Duration::from_secs(
|
||||
std::env::var("SUBSTRATE_TEST_TIMEOUT")
|
||||
.ok()
|
||||
.and_then(|x| x.parse().ok())
|
||||
.unwrap_or(600))
|
||||
).fuse();
|
||||
let actual_test_task = async move {
|
||||
#body
|
||||
}
|
||||
.fuse();
|
||||
|
||||
#crate_name::futures::pin_mut!(timeout_task, actual_test_task);
|
||||
|
||||
#crate_name::futures::select! {
|
||||
_ = timeout_task => {
|
||||
panic!("The test took too long!");
|
||||
},
|
||||
_ = actual_test_task => {},
|
||||
.unwrap_or(600)),
|
||||
async move { #body },
|
||||
).await.is_err() {
|
||||
panic!("The test took too long!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,6 +12,6 @@ publish = false
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "0.2.13", features = ["macros"] }
|
||||
tokio = { version = "1.10", features = ["macros"] }
|
||||
test-utils = { version = "4.0.0-dev", path = "..", package = "substrate-test-utils" }
|
||||
sc-service = { version = "0.10.0-dev", path = "../../client/service" }
|
||||
|
||||
@@ -48,7 +48,7 @@ frame-system = { path = "../../frame/system" }
|
||||
|
||||
log = "0.4.8"
|
||||
futures = "0.3.16"
|
||||
tokio = { version = "0.2", features = ["signal"] }
|
||||
tokio = { version = "1.10", features = ["signal"] }
|
||||
# Calling RPC
|
||||
jsonrpc-core = "18.0"
|
||||
num-traits = "0.2.14"
|
||||
|
||||
@@ -29,7 +29,7 @@ async fn panicking_test(_: TaskExecutor) {
|
||||
panic!("boo!");
|
||||
}
|
||||
|
||||
#[substrate_test_utils::test(max_threads = 2)]
|
||||
#[substrate_test_utils::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
async fn basic_test_with_args(_: TaskExecutor) {
|
||||
assert!(true);
|
||||
}
|
||||
@@ -41,14 +41,14 @@ async fn rename_argument(ex: TaskExecutor) {
|
||||
assert!(true);
|
||||
}
|
||||
|
||||
#[substrate_test_utils::test]
|
||||
#[should_panic(expected = "test took too long")]
|
||||
// NOTE: enable this test only after setting SUBSTRATE_TEST_TIMEOUT to a smaller value
|
||||
//
|
||||
// SUBSTRATE_TEST_TIMEOUT=1 cargo test -- --ignored timeout
|
||||
#[substrate_test_utils::test]
|
||||
#[should_panic(expected = "test took too long")]
|
||||
#[ignore]
|
||||
async fn timeout(_: TaskExecutor) {
|
||||
tokio::time::delay_for(std::time::Duration::from_secs(
|
||||
tokio::time::sleep(std::time::Duration::from_secs(
|
||||
std::env::var("SUBSTRATE_TEST_TIMEOUT")
|
||||
.expect("env var SUBSTRATE_TEST_TIMEOUT has been provided by the user")
|
||||
.parse::<u64>()
|
||||
|
||||
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = [
|
||||
"tokio02",
|
||||
"tokio1",
|
||||
] }
|
||||
jsonrpsee-proc-macros = "0.3.0"
|
||||
|
||||
@@ -30,7 +30,7 @@ sp-runtime = { version = "4.0.0-dev", path = "../../../primitives/runtime" }
|
||||
sp-version = { version = "4.0.0-dev", path = "../../../primitives/version" }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "0.2", features = ["macros", "rt-threaded"] }
|
||||
tokio = { version = "1.10", features = ["macros", "rt-multi-thread"] }
|
||||
pallet-elections-phragmen = { path = "../../../frame/elections-phragmen", version = "5.0.0-dev" }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -25,4 +25,4 @@ sc-rpc-api = { version = "0.10.0-dev", path = "../../../../client/rpc-api" }
|
||||
|
||||
[dev-dependencies]
|
||||
frame-system = { version = "4.0.0-dev", path = "../../../../frame/system" }
|
||||
tokio = "0.2"
|
||||
tokio = "1.10"
|
||||
|
||||
Reference in New Issue
Block a user