Skip to content

Commit

Permalink
Add E2E testing framework MVP (#1395)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cmichi authored Sep 28, 2022
1 parent 9fe9a42 commit 64fbe40
Show file tree
Hide file tree
Showing 29 changed files with 1,824 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .config/cargo_spellcheck.dic
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dereferencing
deserialize/S
deserialization
dispatchable/S
E2E
encodable
evaluable
fuzzer
Expand Down Expand Up @@ -97,6 +98,7 @@ layout/JG
namespace/S
parameterize/SD
runtime/S
storable
struct/S
vec/S
vector/S
Expand All @@ -107,4 +109,4 @@ natively
payability
unpayable
initializer
storable
WebSocket/S
24 changes: 19 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ workflow:
tags:
- kubernetes-parity-build

.start-substrate-contracts-node: &start-substrate-contracts-node
- substrate-contracts-node -linfo,runtime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &

#### stage: lint
#
# Note: For all of these lints we `allow_failure` so that the rest of the build can
Expand Down Expand Up @@ -280,11 +283,21 @@ docs:
paths:
- ./crate-docs/
script:
- cargo doc --no-deps --all-features
-p scale-info -p ink_metadata -p ink_env
-p ink_storage -p ink_storage_traits
-p ink_primitives -p ink_prelude
-p ink -p ink_macro -p ink_ir -p ink_codegen
# All crate docs currently need to be built separately. The reason
# is that `smart-bench-macro` is a dependency now in a number of places.
# This crate uses e.g. `ink_metadata`, but in its published form. So if
# e.g. the `-p ink_metadata` is added to the `ink_lang` command this
# results in the cargo failure "multiple packages with same spec, ambiguous".
- cargo doc --no-deps --all-features -p ink_env
- cargo doc --no-deps --all-features -p ink_storage
- cargo doc --no-deps --all-features -p ink_storage_traits
- cargo doc --no-deps --all-features -p ink_primitives
- cargo doc --no-deps --all-features -p ink_prelude
- cargo doc --no-deps --all-features -p ink
- cargo doc --no-deps --all-features -p ink_macro
- cargo doc --no-deps --all-features -p ink_ir
- cargo doc --no-deps --all-features -p ink_codegen
- cargo doc --no-deps --all-features -p ink_metadata
- mv ${CARGO_TARGET_DIR}/doc ./crate-docs
# FIXME: remove me after CI image gets nonroot
- chown -R nonroot:nonroot ./crate-docs
Expand Down Expand Up @@ -347,6 +360,7 @@ examples-test:
- job: clippy-std
artifacts: false
script:
- *start-substrate-contracts-node
- for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
cargo test --verbose --manifest-path ${example}/Cargo.toml;
Expand Down
20 changes: 20 additions & 0 deletions crates/env/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ secp256k1 = { version = "0.24", features = ["recovery", "global-context"], optio
rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true }
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }

contract-metadata = "2.0.0-alpha.2"
impl-serde = { version = "0.3.1", default-features = false }
jsonrpsee = { version = "0.14.0", features = ["ws-client"] }
pallet-contracts-primitives = "6.0.0"
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
serde_json = "1.0.81"
tokio = { version = "1.18.2", features = ["rt-multi-thread"] }
log = "0.4"
env_logger = "0.8"
subxt = "0.24.0"

# Substrate
sp-rpc = "6.0.0"
sp-core = "6.0.0"
sp-keyring = "6.0.0"
sp-runtime = "6.0.0"

# TODO(#xxx) `smart-bench_macro` needs to be forked.
smart-bench-macro = { git = "https://github.com/paritytech/smart-bench", branch = "cmichi-ink-e2e-test-mvp", package = "smart-bench-macro"}

[features]
default = ["std"]
std = [
Expand Down
Binary file added crates/env/metadata/contracts-node.scale
Binary file not shown.
Loading

0 comments on commit 64fbe40

Please sign in to comment.