mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-22 13:48:04 +00:00
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:
@@ -3,11 +3,14 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{
|
||||
test_context,
|
||||
subxt_test, test_context,
|
||||
utils::{node_runtime, wait_for_blocks},
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
#[cfg(fullclient)]
|
||||
use futures::StreamExt;
|
||||
|
||||
use subxt::{
|
||||
backend::BackendExt,
|
||||
error::{DispatchError, Error},
|
||||
@@ -15,10 +18,13 @@ use subxt::{
|
||||
};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
#[cfg(fullclient)]
|
||||
mod legacy_rpcs;
|
||||
|
||||
mod unstable_rpcs;
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(fullclient)]
|
||||
#[subxt_test]
|
||||
async fn storage_fetch_raw_keys() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
@@ -39,7 +45,8 @@ async fn storage_fetch_raw_keys() {
|
||||
assert_eq!(len, 13)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(fullclient)]
|
||||
#[subxt_test]
|
||||
async fn storage_iter() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
@@ -63,7 +70,8 @@ async fn storage_iter() {
|
||||
assert_eq!(len, 13);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(fullclient)]
|
||||
#[subxt_test]
|
||||
async fn storage_child_values_same_across_backends() {
|
||||
let ctx = test_context().await;
|
||||
|
||||
@@ -103,7 +111,7 @@ async fn storage_child_values_same_across_backends() {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn transaction_validation() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
@@ -137,7 +145,7 @@ async fn transaction_validation() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn validation_fails() {
|
||||
use std::str::FromStr;
|
||||
use subxt_signer::{sr25519::Keypair, SecretUri};
|
||||
@@ -171,7 +179,7 @@ async fn validation_fails() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn external_signing() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
@@ -204,10 +212,11 @@ async fn external_signing() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[cfg(fullclient)]
|
||||
// TODO: Investigate and fix this test failure when using the UnstableBackend.
|
||||
// (https://github.com/paritytech/subxt/issues/1308)
|
||||
#[cfg(not(feature = "unstable-backend-client"))]
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn submit_large_extrinsic() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
@@ -234,7 +243,7 @@ async fn submit_large_extrinsic() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn decode_a_module_error() {
|
||||
use node_runtime::runtime_types::pallet_assets::pallet as assets;
|
||||
|
||||
@@ -248,9 +257,14 @@ async fn decode_a_module_error() {
|
||||
// "unknown" module error from the assets pallet.
|
||||
let freeze_unknown_asset = node_runtime::tx().assets().freeze(1, alice_addr);
|
||||
|
||||
let err = api
|
||||
let signed_extrinsic = api
|
||||
.tx()
|
||||
.sign_and_submit_then_watch_default(&freeze_unknown_asset, &alice)
|
||||
.create_signed(&freeze_unknown_asset, &alice, Default::default())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let err = signed_extrinsic
|
||||
.submit_and_watch()
|
||||
.await
|
||||
.unwrap()
|
||||
.wait_for_finalized_success()
|
||||
@@ -271,7 +285,7 @@ async fn decode_a_module_error() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
@@ -299,7 +313,7 @@ async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() {
|
||||
assert_eq!(actual_tx_bytes, expected_tx_bytes);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn extrinsic_hash_is_same_as_returned() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
@@ -351,7 +365,7 @@ pub struct InclusionFee {
|
||||
pub adjusted_weight_fee: u128,
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[subxt_test]
|
||||
async fn partial_fee_estimate_correct() {
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
|
||||
Reference in New Issue
Block a user