Skip to content

Make generate_test_routes deterministic based on its seed #3754

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

Conversation

TheBlueMatt
Copy link
Collaborator

The intent of generate_test_routes is to be deterministic based on a seed which is printed at the start. That way if a test fails, the seed can be trivially hard-coded and the test can be replicated.

Sadly, it was not, as it used an iterator over an IndexedMap with key order randomization. Luckily, IndexedMap already supports sorted iteration, so we simply use it here.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Apr 28, 2025

I've assigned @valentinewallace as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

The intent of `generate_test_routes` is to be deterministic based
on a seed which is printed at the start. That way if a test fails,
the seed can be trivially hard-coded and the test can be
replicated.

Sadly, it was not, as it used an iterator over an `IndexedMap`
with key order randomization. Luckily, `IndexedMap` already
supports sorted iteration, so we simply use it here.
@TheBlueMatt TheBlueMatt force-pushed the 2025-04-deterministic-determinism branch from b936eb3 to 6cef57b Compare April 28, 2025 23:43
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 89.13%. Comparing base (233aa39) to head (6cef57b).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/routing/router.rs 0.00% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3754   +/-   ##
=======================================
  Coverage   89.13%   89.13%           
=======================================
  Files         157      157           
  Lines      123959   123963    +4     
  Branches   123959   123963    +4     
=======================================
+ Hits       110485   110491    +6     
- Misses      10791    10796    +5     
+ Partials     2683     2676    -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@valentinewallace valentinewallace merged commit 16307f6 into lightningdevkit:main Apr 29, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants