Skip to content

perf: Speed up registry integration tests#8679

Open
dsarlis wants to merge 4 commits intodfinity:masterfrom
dsarlis:dimitris/speed-up-registry-integration-tests
Open

perf: Speed up registry integration tests#8679
dsarlis wants to merge 4 commits intodfinity:masterfrom
dsarlis:dimitris/speed-up-registry-integration-tests

Conversation

@dsarlis
Copy link
Contributor

@dsarlis dsarlis commented Feb 4, 2026

This is a drive-by improvement that I noticed. Simply replacing state_machine_test_on_nns_subnet instead of local_test_on_nns_subnet in registry integration tests results in significant speed up of the respective tests. Reductions in test runtimes range from about ~30% to ~60% (for the tests that were using this function).

Note that there was one test where local_test_on_nns_subnet_with_mutations is used which does not have a state machine equivalent. As I was unsure about the amount of work involved, I left it outside this PR.

@dsarlis dsarlis requested a review from a team as a code owner February 4, 2026 16:48
@github-actions github-actions bot added the perf label Feb 4, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@cla-idx-bot
Copy link

cla-idx-bot bot commented Feb 4, 2026

Dear @dsarlis,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA.

If you decide to agree with it, please visit this issue and read the instructions there. Once you have signed it, re-trigger the workflow on this PR to see if your code can be merged.

— The DFINITY Foundation

@cla-idx-bot cla-idx-bot bot mentioned this pull request Feb 4, 2026
@dsarlis
Copy link
Contributor Author

dsarlis commented Feb 4, 2026

I cannot dismiss the review of github-bot as I do not have write access anymore. I would therefore request a member of the Governance team to do it on my behalf, the changes are only affecting tests, so they should be fine to merge.

@dsarlis
Copy link
Contributor Author

dsarlis commented Feb 4, 2026

I also attach the results I got from a run in my local environment.

Before:

//rs/registry/canister:registry_canister_integration_test_tests/add_node PASSED in 93.1s
//rs/registry/canister:registry_canister_integration_test_tests/add_node_operator PASSED in 88.9s
//rs/registry/canister:registry_canister_integration_test_tests/add_nodes_to_subnet PASSED in 101.9s
//rs/registry/canister:registry_canister_integration_test_tests/add_or_remove_data_centers PASSED in 84.5s
//rs/registry/canister:registry_canister_integration_test_tests/change_subnet_membership PASSED in 117.2s
//rs/registry/canister:registry_canister_integration_test_tests/clear_provisional_whitelist PASSED in 96.9s
//rs/registry/canister:registry_canister_integration_test_tests/create_subnet PASSED in 215.2s
//rs/registry/canister:registry_canister_integration_test_tests/hostos_version PASSED in 100.4s
//rs/registry/canister:registry_canister_integration_test_tests/integration_tests PASSED in 86.6s
//rs/registry/canister:registry_canister_integration_test_tests/integration_tests_2 PASSED in 124.2s
//rs/registry/canister:registry_canister_integration_test_tests/integration_tests_3 PASSED in 96.3s
//rs/registry/canister:registry_canister_integration_test_tests/modify_canister_migrations PASSED in 116.0s
//rs/registry/canister:registry_canister_integration_test_tests/recover_subnet PASSED in 118.1s
//rs/registry/canister:registry_canister_integration_test_tests/remove_node_directly PASSED in 85.7s
//rs/registry/canister:registry_canister_integration_test_tests/remove_node_operators PASSED in 92.2s
//rs/registry/canister:registry_canister_integration_test_tests/remove_nodes PASSED in 103.8s
//rs/registry/canister:registry_canister_integration_test_tests/remove_nodes_from_subnet PASSED in 90.2s
//rs/registry/canister:registry_canister_integration_test_tests/reroute_canister_ranges PASSED in 93.4s
//rs/registry/canister:registry_canister_integration_test_tests/roll_back_canister_migration PASSED in 103.9s
//rs/registry/canister:registry_canister_integration_test_tests/swap_node_in_subnet_directly PASSED in 58.1s
//rs/registry/canister:registry_canister_integration_test_tests/update_node_operator_config PASSED in 81.6s
//rs/registry/canister:registry_canister_integration_test_tests/update_node_operator_config_directly PASSED in 87.6s
//rs/registry/canister:registry_canister_integration_test_tests/update_node_rewards_table PASSED in 87.5s
//rs/registry/canister:registry_canister_integration_test_tests/update_subnet PASSED in 112.8s
//rs/registry/canister:registry_canister_integration_test_tests/update_subnet_and_bless_replica_version PASSED in 100.8s
//rs/registry/canister:registry_canister_integration_test_tests/update_unassigned_nodes_config PASSED in 92.2s
//rs/registry/canister:registry_canister_integration_test_tests/rate_limits FAILED in 123.2s

After

//rs/registry/canister:registry_canister_integration_test_tests/integration_tests (cached) PASSED in 86.6s
//rs/registry/canister:registry_canister_integration_test_tests/recover_subnet (cached) PASSED in 118.1s
//rs/registry/canister:registry_canister_integration_test_tests/swap_node_in_subnet_directly (cached) PASSED in 58.1s
//rs/registry/canister:registry_canister_integration_test_tests/add_node_operator PASSED in 22.8s
//rs/registry/canister:registry_canister_integration_test_tests/add_nodes_to_subnet PASSED in 35.7s
//rs/registry/canister:registry_canister_integration_test_tests/add_or_remove_data_centers PASSED in 33.3s
//rs/registry/canister:registry_canister_integration_test_tests/change_subnet_membership PASSED in 35.3s
//rs/registry/canister:registry_canister_integration_test_tests/integration_tests_2 PASSED in 38.8s
//rs/registry/canister:registry_canister_integration_test_tests/remove_node_directly PASSED in 13.9s
//rs/registry/canister:registry_canister_integration_test_tests/remove_node_operators PASSED in 29.9s
//rs/registry/canister:registry_canister_integration_test_tests/remove_nodes PASSED in 35.9s
//rs/registry/canister:registry_canister_integration_test_tests/reroute_canister_ranges PASSED in 35.1s
//rs/registry/canister:registry_canister_integration_test_tests/update_node_operator_config_directly PASSED in 30.7s
//rs/registry/canister:registry_canister_integration_test_tests/update_node_rewards_table PASSED in 31.4s
//rs/registry/canister:registry_canister_integration_test_tests/add_node PASSED in 52.5s
//rs/registry/canister:registry_canister_integration_test_tests/clear_provisional_whitelist PASSED in 57.9s
//rs/registry/canister:registry_canister_integration_test_tests/hostos_version PASSED in 58.3s
//rs/registry/canister:registry_canister_integration_test_tests/integration_tests_3 PASSED in 59.2s
//rs/registry/canister:registry_canister_integration_test_tests/modify_canister_migrations PASSED in 60.7s
//rs/registry/canister:registry_canister_integration_test_tests/rate_limits PASSED in 71.9s
//rs/registry/canister:registry_canister_integration_test_tests/remove_nodes_from_subnet PASSED in 60.4s
//rs/registry/canister:registry_canister_integration_test_tests/roll_back_canister_migration PASSED in 59.9s
//rs/registry/canister:registry_canister_integration_test_tests/update_node_operator_config PASSED in 60.1s
//rs/registry/canister:registry_canister_integration_test_tests/update_subnet PASSED in 59.9s
//rs/registry/canister:registry_canister_integration_test_tests/update_subnet_and_bless_replica_version PASSED in 57.4s
//rs/registry/canister:registry_canister_integration_test_tests/update_unassigned_nodes_config PASSED in 57.8s
//rs/registry/canister:registry_canister_integration_test_tests/create_subnet FAILED in 80.3s

Note that in both runs 1 test failed (but it's different), I assume this is some flakiness especially since the first run is on clean master (runtimes are prohibitively slow for me to run multiple times to get averages).

@basvandijk basvandijk added the security-review-passed IDX or InfraSec have concluded it's safe to run CI on the external PR. label Feb 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

@basvandijk
Copy link
Collaborator

Hey @dsarlis! Nice to see you driving by!

I see our Auto fix job is failing. I'll look into that tomorrow. For the moment could you run a cargo fmt manually?

jasonz-dfinity
jasonz-dfinity previously approved these changes Feb 4, 2026
@mraszyk
Copy link
Contributor

mraszyk commented Feb 4, 2026

Indeed, great to see you back, @dsarlis !

@github-actions github-actions bot dismissed jasonz-dfinity’s stale review February 5, 2026 07:56

Review dismissed by automation script.

@dsarlis
Copy link
Contributor Author

dsarlis commented Feb 5, 2026

Hey @dsarlis! Nice to see you driving by!

I see our Auto fix job is failing. I'll look into that tomorrow. For the moment could you run a cargo fmt manually?

Thanks Bas, I fixed the formatting manually.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

@basvandijk
Copy link
Collaborator

@dsarlis //rs/registry/canister:registry_canister_integration_test_tests/create_subnet failed with:

failures:
---- test_accepted_proposal_mutates_the_registry_some_subnets_present stdout ----
thread 'test_accepted_proposal_mutates_the_registry_some_subnets_present' panicked at rs/registry/canister/tests/create_subnet.rs:150:17:
Cannot run this test on Runtime::Remote or Runtime::StateMachine at this time
stack backtrace:
   0:     0x642de625d3f2 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hdcfcb6d4c8489523
   1:     0x642de628d6e3 - core::fmt::write::h8a494366950f23bb
   2:     0x642de6258033 - std::io::Write::write_fmt::h4e71294925c334d0
   3:     0x642de625d242 - std::sys::backtrace::BacktraceLock::print::hb2a626a81e06b2dc
   4:     0x642de625fac9 - std::panicking::default_hook::{{closure}}::h4f78485264f12d10
   5:     0x642de625f8fe - std::panicking::default_hook::h2c66fc99e962531d
   6:     0x642de267a004 - test::test_main_with_exit_callback::{{closure}}::h60217ec76a0ece4a
   7:     0x642de626059e - std::panicking::rust_panic_with_hook::h33ac55f64bbd807d
   8:     0x642de6260236 - std::panicking::begin_panic_handler::{{closure}}::h30e7cb89678a57fe
   9:     0x642de625d8f9 - std::sys::backtrace::__rust_end_short_backtrace::hed60f27456c16ced
  10:     0x642de625fefd - __rustc[de2ca18b4c54d5b8]::rust_begin_unwind
  11:     0x642de628a4a0 - core::panicking::panic_fmt::h62f63d096dd276af
  12:     0x642de2570f0b - registry_canister_integration_test_tests_create_subnet::test_accepted_proposal_mutates_the_registry_some_subnets_present::{{closure}}::{{closure}}::h8648d8fac892cf8c
  13:     0x642de255373e - futures_util::future::future::FutureExt::now_or_never::hcf2f77968711bdcf
  14:     0x642de2572f0c - ic_nns_test_utils::itest_helpers::state_machine_test_on_nns_subnet::h630f3a29266f5ee4
  15:     0x642de2561bf9 - core::ops::function::FnOnce::call_once::h621a932c213359a6
  16:     0x642de267f86b - test::__rust_begin_short_backtrace::ha52ab26e77157f03
  17:     0x642de267e9a5 - test::run_test::{{closure}}::h0364ba59bf23f652
  18:     0x642de26425a4 - std::sys::backtrace::__rust_begin_short_backtrace::h177cb952fc54ad2c
  19:     0x642de2645f7a - core::ops::function::FnOnce::call_once{{vtable.shim}}::hddcd7484a13fd793
  20:     0x642de6263eff - std::sys::pal::unix::thread::Thread::new::thread_start::hb6e99e73da4d28f8
  21:     0x732cb60c2aa4 - <unknown>
  22:     0x732cb614fc6c - <unknown>
failures:
    test_accepted_proposal_mutates_the_registry_some_subnets_present
test result: FAILED. 5 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 40.43s

Do you think that's flakiness? I'll restart the test to check ...

@dsarlis
Copy link
Contributor Author

dsarlis commented Feb 5, 2026

Cannot run this test on Runtime::Remote or Runtime::StateMachine at this time

@basvandijk No, I see now that this test explicitly does not want to run on a StateMachine test environment for whatever reason. I'll revert to the old function for this test.

@dsarlis
Copy link
Contributor Author

dsarlis commented Feb 5, 2026

Cannot run this test on Runtime::Remote or Runtime::StateMachine at this time

@basvandijk No, I see now that this test explicitly does not want to run on a StateMachine test environment for whatever reason. I'll revert to the old function for this test.

@basvandijk I pushed a commit to revert the test.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor @governance-team perf security-review-passed IDX or InfraSec have concluded it's safe to run CI on the external PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants