testing: Prepare light client testing with substrate binary and add subxt-test macro (#1507)

* testing: Add long running light client flag and cfg aliases

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Expose clients depending on feature flags

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Use unstable backend for light client

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Disable flaky lightclient tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Add long runnnig step

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert "subxt: Use unstable backend for light client"

This reverts commit ea6f3cc58b.

* ci: Long running tests for 60 mins

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Use 16 cores for light-client testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Isolate light-client testing to save CI minutes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Retry on Tx::Dropped for lightclinet only

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Wait for more blocks for the lightclient init

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Use unstable backend for light client

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Disable legacy RPC tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Disable sudo and contracts tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Retry constructing lightclient on read-proof errors

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Disable tx dynamic test

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* proc-macro: Timeout for tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Add timeout 800 seconds

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* proc-macro/tests: Adjust subxt-test proc-macro

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* proc-macro: Rename crate to subxt-test-proc-macro

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Use default subxt-proc-macro timeout

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* light-client: Remove println

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Remove tokio as dependency, use it only for testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Chagne default timeout to 6 seconds

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* proc-macro: Add env timeout variable

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Add subxt env var for controling test timeouts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests/tx-retries: Retry on `Non node available` error

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Use unstable backend for testing lightclient

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Remove old lightclient object

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Adjust for the new interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* backend/rpc: Allow older version of the initialized event

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* rpc/tests: Check initialized decodes correctly

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Reset workflow

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Apply cargo fmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove unused dep

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove gitmerge old file

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove unused dep

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* rename proc-macro to subxt-test-macro

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Remove txretries for lightclient

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Wait for 5 blocks for the lightclient full testing suite

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Group imports

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* macro: Rename const value

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2024-04-08 11:34:20 +03:00
committed by GitHub
parent 827a35de34
commit b31131d21d
26 changed files with 555 additions and 182 deletions
@@ -5,7 +5,7 @@
//! Just sanity checking some of the new RPC methods to try and
//! catch differences as the implementations evolve.
use crate::{test_context, utils::node_runtime};
use crate::{subxt_test, test_context, utils::node_runtime};
use assert_matches::assert_matches;
use codec::Encode;
use futures::Stream;
@@ -18,9 +18,10 @@ use subxt::{
utils::{AccountId32, MultiAddress},
SubstrateConfig,
};
use subxt_signer::sr25519::dev;
#[tokio::test]
#[subxt_test]
async fn chainhead_unstable_follow() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
@@ -60,7 +61,7 @@ async fn chainhead_unstable_follow() {
);
}
#[tokio::test]
#[subxt_test]
async fn chainhead_unstable_body() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
@@ -88,7 +89,7 @@ async fn chainhead_unstable_body() {
);
}
#[tokio::test]
#[subxt_test]
async fn chainhead_unstable_header() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
@@ -116,7 +117,7 @@ async fn chainhead_unstable_header() {
assert_eq!(new_header, old_header);
}
#[tokio::test]
#[subxt_test]
async fn chainhead_unstable_storage() {
let ctx = test_context().await;
let api = ctx.client();
@@ -162,7 +163,7 @@ async fn chainhead_unstable_storage() {
assert_matches!(event, FollowEvent::OperationStorageDone(res) if res.operation_id == operation_id);
}
#[tokio::test]
#[subxt_test]
async fn chainhead_unstable_call() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
@@ -199,7 +200,7 @@ async fn chainhead_unstable_call() {
);
}
#[tokio::test]
#[subxt_test]
async fn chainhead_unstable_unpin() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
@@ -217,7 +218,8 @@ async fn chainhead_unstable_unpin() {
assert!(rpc.chainhead_unstable_unpin(sub_id, hash).await.is_err());
}
#[tokio::test]
#[cfg(fullclient)]
#[subxt_test]
async fn chainspec_v1_genesishash() {
let ctx = test_context().await;
let old_rpc = ctx.legacy_rpc_methods().await;
@@ -229,7 +231,8 @@ async fn chainspec_v1_genesishash() {
assert_eq!(a, b);
}
#[tokio::test]
#[cfg(fullclient)]
#[subxt_test]
async fn chainspec_v1_chainname() {
let ctx = test_context().await;
let old_rpc = ctx.legacy_rpc_methods().await;
@@ -241,7 +244,8 @@ async fn chainspec_v1_chainname() {
assert_eq!(a, b);
}
#[tokio::test]
#[cfg(fullclient)]
#[subxt_test]
async fn chainspec_v1_properties() {
let ctx = test_context().await;
let old_rpc = ctx.legacy_rpc_methods().await;
@@ -253,7 +257,8 @@ async fn chainspec_v1_properties() {
assert_eq!(a, b);
}
#[tokio::test]
#[cfg(fullclient)]
#[subxt_test]
async fn transaction_unstable_submit_and_watch() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;