Skip to content

Fix lightning-persister tests for upcoming rustc changes #1033

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

Merged
merged 2 commits into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ jobs:
platform: macos-latest
build-net-tokio: true
build-no-std: true
- toolchain: beta
platform: macos-latest
build-net-tokio: true
build-no-std: true
- toolchain: stable
platform: windows-latest
build-net-tokio: true
build-no-std: true
- toolchain: beta
platform: windows-latest
build-net-tokio: true
build-no-std: true
- toolchain: beta
build-net-tokio: true
build-no-std: true
Expand Down
5 changes: 4 additions & 1 deletion lightning-block-sync/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,10 @@ pub(crate) mod client_tests {
#[test]
fn connect_to_unresolvable_host() {
match HttpClient::connect(("example.invalid", 80)) {
Err(e) => assert_eq!(e.kind(), std::io::ErrorKind::Other),
Err(e) => {
assert!(e.to_string().contains("failed to lookup address information") ||
e.to_string().contains("No such host"), "{:?}", e);
},
Ok(_) => panic!("Expected error"),
}
}
Expand Down
4 changes: 2 additions & 2 deletions lightning-persister/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ mod tests {
// Create the channel data file and make it a directory.
fs::create_dir_all(get_full_filepath(path.clone(), filename.to_string())).unwrap();
match write_to_file(path.clone(), filename.to_string(), &test_writeable) {
Err(e) => assert_eq!(e.kind(), io::ErrorKind::Other),
Err(e) => assert_eq!(e.raw_os_error(), Some(libc::EISDIR)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a TODO to switch back to kind once possible. Though I guess that is a long way out. 😕

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea, that's gonna require at least rustc-now, so I guess in at least two years per the rust-bitcoin MSRV policy, assuming distros upgrade. I think this is fine, in any case, at least it won't break.

_ => panic!("Unexpected Ok(())")
}
fs::remove_dir_all(path).unwrap();
Expand Down Expand Up @@ -178,7 +178,7 @@ mod tests {
match write_to_file(path, filename, &test_writeable) {
Err(e) => {
#[cfg(not(target_os = "windows"))]
assert_eq!(e.kind(), io::ErrorKind::Other);
assert_eq!(e.raw_os_error(), Some(libc::EISDIR));
#[cfg(target_os = "windows")]
assert_eq!(e.kind(), io::ErrorKind::PermissionDenied);
}
Expand Down