Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 44 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
34e9222
testing: Add long running light client flag and cfg aliases
lexnv Feb 29, 2024
518aa8e
testing: Expose clients depending on feature flags
lexnv Feb 29, 2024
ea6f3cc
subxt: Use unstable backend for light client
lexnv Feb 29, 2024
ca36ef6
testing: Disable flaky lightclient tests
lexnv Feb 29, 2024
8fe7e86
ci: Add long runnnig step
lexnv Feb 29, 2024
593fbeb
Revert "subxt: Use unstable backend for light client"
lexnv Feb 29, 2024
1fc1bb4
ci: Long running tests for 60 mins
lexnv Feb 29, 2024
ca60c31
ci: Use 16 cores for light-client testing
lexnv Feb 29, 2024
3c58c5e
ci: Isolate light-client testing to save CI minutes
lexnv Feb 29, 2024
0248343
testing: Retry on Tx::Dropped for lightclinet only
lexnv Mar 1, 2024
8400a0e
testing: Wait for more blocks for the lightclient init
lexnv Mar 1, 2024
d671664
subxt: Use unstable backend for light client
lexnv Feb 29, 2024
318ba5c
testing: Disable legacy RPC tests
lexnv Mar 1, 2024
1a6f1af
testing: Disable sudo and contracts tests
lexnv Mar 1, 2024
332fa72
testing: Retry constructing lightclient on read-proof errors
lexnv Mar 1, 2024
88ccc54
testing: Disable tx dynamic test
lexnv Mar 1, 2024
b6c98c7
proc-macro: Timeout for tests
lexnv Mar 1, 2024
20e75bc
testing: Add timeout 800 seconds
lexnv Mar 1, 2024
c5c7972
proc-macro/tests: Adjust subxt-test proc-macro
lexnv Mar 4, 2024
d3923c8
proc-macro: Rename crate to subxt-test-proc-macro
lexnv Mar 5, 2024
1a64750
Use default subxt-proc-macro timeout
lexnv Mar 5, 2024
4c3226e
light-client: Remove println
lexnv Mar 5, 2024
fbe2a74
subxt: Remove tokio as dependency, use it only for testing
lexnv Mar 5, 2024
30073d3
testing: Chagne default timeout to 6 seconds
lexnv Mar 5, 2024
aa55cea
proc-macro: Add env timeout variable
lexnv Mar 6, 2024
09277fe
ci: Add subxt env var for controling test timeouts
lexnv Mar 6, 2024
5039f1c
tests/tx-retries: Retry on `Non node available` error
lexnv Mar 6, 2024
410aaed
Merge remote-tracking branch 'origin/master' into lenxv/light-client-…
lexnv Mar 26, 2024
d81c70c
testing: Use unstable backend for testing lightclient
lexnv Mar 26, 2024
00c4b78
testing: Remove old lightclient object
lexnv Mar 26, 2024
03da904
testing: Adjust for the new interface
lexnv Mar 26, 2024
292f971
backend/rpc: Allow older version of the initialized event
lexnv Mar 27, 2024
2bc8947
rpc/tests: Check initialized decodes correctly
lexnv Mar 28, 2024
811f70c
ci: Reset workflow
lexnv Mar 28, 2024
2bb8acb
Apply cargo fmt
lexnv Mar 28, 2024
1fdd734
Remove unused dep
lexnv Mar 28, 2024
1bc6eb9
Merge remote-tracking branch 'origin/master' into lexnv/light-client-…
lexnv Mar 28, 2024
5692703
Remove gitmerge old file
lexnv Mar 28, 2024
fd47be1
Remove unused dep
lexnv Mar 28, 2024
be4b34c
rename proc-macro to subxt-test-macro
lexnv Apr 2, 2024
7270da8
tests: Remove txretries for lightclient
lexnv Apr 3, 2024
a62ceb7
tests: Wait for 5 blocks for the lightclient full testing suite
lexnv Apr 3, 2024
7664b56
tests: Group imports
lexnv Apr 8, 2024
510578f
macro: Rename const value
lexnv Apr 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use default subxt-proc-macro timeout
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed Mar 5, 2024
commit 1a647500a7d87fa48296b41dd1a708f8f72d15db
12 changes: 6 additions & 6 deletions testing/integration-tests/src/full_client/blocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use subxt_signer::sr25519::dev;
use subxt_metadata::Metadata;

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn block_subscriptions_are_consistent_with_eachother() -> Result<(), subxt::Error> {
let ctx = test_context().await;
let api = ctx.client();
Expand Down Expand Up @@ -89,7 +89,7 @@ async fn block_subscriptions_are_consistent_with_eachother() -> Result<(), subxt
Ok(())
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn finalized_headers_subscription() -> Result<(), subxt::Error> {
let ctx = test_context().await;
let api = ctx.client();
Expand All @@ -106,7 +106,7 @@ async fn finalized_headers_subscription() -> Result<(), subxt::Error> {
Ok(())
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn missing_block_headers_will_be_filled_in() -> Result<(), subxt::Error> {
use subxt::backend::legacy;

Expand Down Expand Up @@ -151,7 +151,7 @@ async fn missing_block_headers_will_be_filled_in() -> Result<(), subxt::Error> {
}

// Check that we can subscribe to non-finalized blocks.
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn runtime_api_call() -> Result<(), subxt::Error> {
let ctx = test_context().await;
let api = ctx.client();
Expand All @@ -177,7 +177,7 @@ async fn runtime_api_call() -> Result<(), subxt::Error> {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn fetch_block_and_decode_extrinsic_details() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down Expand Up @@ -247,7 +247,7 @@ async fn fetch_block_and_decode_extrinsic_details() {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn decode_signed_extensions_from_blocks() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down
28 changes: 14 additions & 14 deletions testing/integration-tests/src/full_client/client/legacy_rpcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

use crate::{subxt_test, test_context};

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chain_get_block_hash() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

rpc.chain_get_block_hash(None).await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chain_get_block() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -24,15 +24,15 @@ async fn chain_get_block() {
rpc.chain_get_block(hash).await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chain_get_finalized_head() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

rpc.chain_get_finalized_head().await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chain_subscribe_all_heads() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -41,7 +41,7 @@ async fn chain_subscribe_all_heads() {
let _block_header = sub.next().await.unwrap().unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chain_subscribe_finalized_heads() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -50,7 +50,7 @@ async fn chain_subscribe_finalized_heads() {
let _block_header = sub.next().await.unwrap().unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chain_subscribe_new_heads() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -59,23 +59,23 @@ async fn chain_subscribe_new_heads() {
let _block_header = sub.next().await.unwrap().unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn genesis_hash() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

let _genesis_hash = rpc.genesis_hash().await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn state_get_metadata() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

let _metadata = rpc.state_get_metadata(None).await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn state_call() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -86,39 +86,39 @@ async fn state_call() {
.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn system_health() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

let _ = rpc.system_health().await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn system_chain() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

let _ = rpc.system_chain().await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn system_name() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

let _ = rpc.system_name().await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn system_version() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;

let _ = rpc.system_version().await.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn system_properties() {
let ctx = test_context().await;
let rpc = ctx.legacy_rpc_methods().await;
Expand Down
22 changes: 11 additions & 11 deletions testing/integration-tests/src/full_client/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod legacy_rpcs;
mod unstable_rpcs;

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn storage_fetch_raw_keys() {
let ctx = test_context().await;
let api = ctx.client();
Expand All @@ -49,7 +49,7 @@ async fn storage_fetch_raw_keys() {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn storage_iter() {
let ctx = test_context().await;
let api = ctx.client();
Expand All @@ -74,7 +74,7 @@ async fn storage_iter() {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn storage_child_values_same_across_backends() {
let ctx = test_context().await;

Expand Down Expand Up @@ -114,7 +114,7 @@ async fn storage_child_values_same_across_backends() {
}
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn transaction_validation() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down Expand Up @@ -144,7 +144,7 @@ async fn transaction_validation() {
.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn validation_fails() {
use std::str::FromStr;
use subxt_signer::{sr25519::Keypair, SecretUri};
Expand Down Expand Up @@ -178,7 +178,7 @@ async fn validation_fails() {
);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn external_signing() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down Expand Up @@ -211,7 +211,7 @@ async fn external_signing() {
// TODO: Investigate and fix this test failure when using the UnstableBackend.
// (https://github.com/paritytech/subxt/issues/1308)
#[cfg(not(feature = "unstable-backend-client"))]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn submit_large_extrinsic() {
let ctx = test_context().await;
let api = ctx.client();
Expand All @@ -238,7 +238,7 @@ async fn submit_large_extrinsic() {
.unwrap();
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn decode_a_module_error() {
use node_runtime::runtime_types::pallet_assets::pallet as assets;

Expand Down Expand Up @@ -276,7 +276,7 @@ async fn decode_a_module_error() {
);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down Expand Up @@ -304,7 +304,7 @@ async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() {
assert_eq!(actual_tx_bytes, expected_tx_bytes);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn extrinsic_hash_is_same_as_returned() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down Expand Up @@ -356,7 +356,7 @@ pub struct InclusionFee {
pub adjusted_weight_fee: u128,
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn partial_fee_estimate_correct() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down
20 changes: 10 additions & 10 deletions testing/integration-tests/src/full_client/client/unstable_rpcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use subxt::client::OfflineClientT;

use subxt_signer::sr25519::dev;

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainhead_unstable_follow() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
Expand Down Expand Up @@ -62,7 +62,7 @@ async fn chainhead_unstable_follow() {
);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainhead_unstable_body() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
Expand Down Expand Up @@ -90,7 +90,7 @@ async fn chainhead_unstable_body() {
);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainhead_unstable_header() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
Expand Down Expand Up @@ -118,7 +118,7 @@ async fn chainhead_unstable_header() {
assert_eq!(new_header, old_header);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainhead_unstable_storage() {
let ctx = test_context().await;
let api = ctx.client();
Expand Down Expand Up @@ -164,7 +164,7 @@ async fn chainhead_unstable_storage() {
assert_matches!(event, FollowEvent::OperationStorageDone(res) if res.operation_id == operation_id);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainhead_unstable_call() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
Expand Down Expand Up @@ -201,7 +201,7 @@ async fn chainhead_unstable_call() {
);
}

#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainhead_unstable_unpin() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
Expand All @@ -220,7 +220,7 @@ async fn chainhead_unstable_unpin() {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainspec_v1_genesishash() {
let ctx = test_context().await;
let old_rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -233,7 +233,7 @@ async fn chainspec_v1_genesishash() {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainspec_v1_chainname() {
let ctx = test_context().await;
let old_rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -246,7 +246,7 @@ async fn chainspec_v1_chainname() {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn chainspec_v1_properties() {
let ctx = test_context().await;
let old_rpc = ctx.legacy_rpc_methods().await;
Expand All @@ -259,7 +259,7 @@ async fn chainspec_v1_properties() {
}

#[cfg(fullclient)]
#[subxt_test(timeout = 800)]
#[subxt_test]
async fn transaction_unstable_submit_and_watch() {
let ctx = test_context().await;
let rpc = ctx.unstable_rpc_methods().await;
Expand Down
Loading