-
Notifications
You must be signed in to change notification settings - Fork 411
Replace lightning-block-sync
test that depended on foo.com
#2655
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
Replace lightning-block-sync
test that depended on foo.com
#2655
Conversation
Codecov ReportAll modified lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2655 +/- ##
==========================================
+ Coverage 89.00% 89.27% +0.27%
==========================================
Files 112 112
Lines 87157 88472 +1315
Branches 87157 88472 +1315
==========================================
+ Hits 77574 78986 +1412
+ Misses 7339 7301 -38
+ Partials 2244 2185 -59
☔ View full report in Codecov by Sentry. |
Looks like https://bitcoincore.org is down? |
lightning-block-sync/src/http.rs
Outdated
assert!(http_addr.is_some(), "Expected socket address"); | ||
while let Some(addr) = http_addr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could use peekable
and iterate with a for
loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, dont even need peekable.
0753f20
to
039ffa0
Compare
Our tests should generally not rely on internet access, and should not rely on the behavior of any given remote server. However, one of the `endpoint_tests` in `lightning-block-sync::http` relied on `foo.com` resolving to a single socket address, which both might change in the future and makes our tests fail without internet.
039ffa0
to
631f989
Compare
} | ||
assert!(std_addrs.next().is_none()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we are assuming std_addrs
contains at least one item? Probably fine but just want to call that out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, you need peekable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No? We only check that the two iterators are exactly equal, not that either contain anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, the old code made sure there was at least one with panic!("Expected socket address")
. Without that, you may skip the check entirely if the size is zero, meaning the test isn't checking anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yea, I don't think we need to check that. Like, in theory someone could have a horrendously misconfigured system where localhost
doesn't resolve to anything. We shouldn't fail tests if that happens, though honestly I'm surprised that system is running and not randomly crashing in other places :)
Our tests should generally not rely on internet access, and should not rely on the behavior of any given remote server. However, one of the
endpoint_tests
inlightning-block-sync::http
relied onfoo.com
resolving to a single socket address, which both might change in the future and makes our tests fail without internet.