Skip to content

Commit 64fbe40

Browse files
authored
Add E2E testing framework MVP (#1395)
* Add missing words to spellcheck dictionary * Add `contracts-node.scale` metadata Has been exported via cargo install subxt-cli subxt metadata > contracts-node.scale For `substrate-contracts-node` v0.20.0. * Run `substrate-contracts-node` in CI * Invoke `cargo doc` separately for each crate * Add MVP for E2E testing framework * Add E2E tests for `contract-transfer` example * Add ToDo comment for migration to `state_call` RPC * Update to new `ink` entrance crate * Add ToDo for `node_log_contains` * Update to `ink` entrance crate * Migrate to `state_call` RPC * Always initialize `env_logger` * Use latest `subxt` release * Remove superfluous TODO * Apply `cargo fmt` * Adapt test fixtures
1 parent 9fe9a42 commit 64fbe40

29 files changed

+1824
-13
lines changed

.config/cargo_spellcheck.dic

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dereferencing
4040
deserialize/S
4141
deserialization
4242
dispatchable/S
43+
E2E
4344
encodable
4445
evaluable
4546
fuzzer
@@ -97,6 +98,7 @@ layout/JG
9798
namespace/S
9899
parameterize/SD
99100
runtime/S
101+
storable
100102
struct/S
101103
vec/S
102104
vector/S
@@ -107,4 +109,4 @@ natively
107109
payability
108110
unpayable
109111
initializer
110-
storable
112+
WebSocket/S

.gitlab-ci.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ workflow:
8686
tags:
8787
- kubernetes-parity-build
8888

89+
.start-substrate-contracts-node: &start-substrate-contracts-node
90+
- substrate-contracts-node -linfo,runtime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &
91+
8992
#### stage: lint
9093
#
9194
# Note: For all of these lints we `allow_failure` so that the rest of the build can
@@ -280,11 +283,21 @@ docs:
280283
paths:
281284
- ./crate-docs/
282285
script:
283-
- cargo doc --no-deps --all-features
284-
-p scale-info -p ink_metadata -p ink_env
285-
-p ink_storage -p ink_storage_traits
286-
-p ink_primitives -p ink_prelude
287-
-p ink -p ink_macro -p ink_ir -p ink_codegen
286+
# All crate docs currently need to be built separately. The reason
287+
# is that `smart-bench-macro` is a dependency now in a number of places.
288+
# This crate uses e.g. `ink_metadata`, but in its published form. So if
289+
# e.g. the `-p ink_metadata` is added to the `ink_lang` command this
290+
# results in the cargo failure "multiple packages with same spec, ambiguous".
291+
- cargo doc --no-deps --all-features -p ink_env
292+
- cargo doc --no-deps --all-features -p ink_storage
293+
- cargo doc --no-deps --all-features -p ink_storage_traits
294+
- cargo doc --no-deps --all-features -p ink_primitives
295+
- cargo doc --no-deps --all-features -p ink_prelude
296+
- cargo doc --no-deps --all-features -p ink
297+
- cargo doc --no-deps --all-features -p ink_macro
298+
- cargo doc --no-deps --all-features -p ink_ir
299+
- cargo doc --no-deps --all-features -p ink_codegen
300+
- cargo doc --no-deps --all-features -p ink_metadata
288301
- mv ${CARGO_TARGET_DIR}/doc ./crate-docs
289302
# FIXME: remove me after CI image gets nonroot
290303
- chown -R nonroot:nonroot ./crate-docs
@@ -347,6 +360,7 @@ examples-test:
347360
- job: clippy-std
348361
artifacts: false
349362
script:
363+
- *start-substrate-contracts-node
350364
- for example in examples/*/; do
351365
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
352366
cargo test --verbose --manifest-path ${example}/Cargo.toml;

crates/env/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ secp256k1 = { version = "0.24", features = ["recovery", "global-context"], optio
5050
rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true }
5151
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }
5252

53+
contract-metadata = "2.0.0-alpha.2"
54+
impl-serde = { version = "0.3.1", default-features = false }
55+
jsonrpsee = { version = "0.14.0", features = ["ws-client"] }
56+
pallet-contracts-primitives = "6.0.0"
57+
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
58+
serde_json = "1.0.81"
59+
tokio = { version = "1.18.2", features = ["rt-multi-thread"] }
60+
log = "0.4"
61+
env_logger = "0.8"
62+
subxt = "0.24.0"
63+
64+
# Substrate
65+
sp-rpc = "6.0.0"
66+
sp-core = "6.0.0"
67+
sp-keyring = "6.0.0"
68+
sp-runtime = "6.0.0"
69+
70+
# TODO(#xxx) `smart-bench_macro` needs to be forked.
71+
smart-bench-macro = { git = "https://github.com/paritytech/smart-bench", branch = "cmichi-ink-e2e-test-mvp", package = "smart-bench-macro"}
72+
5373
[features]
5474
default = ["std"]
5575
std = [
47.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)