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

Bump octocrab from 0.28.0 to 0.29.1 #1193

Merged
merged 2 commits into from
Aug 7, 2023
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 20 additions & 7 deletions lychee-bin/src/archive/wayback/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,29 @@ where
mod tests {
use crate::archive::wayback::get_wayback_link;
use reqwest::Error;
use std::{error::Error as StdError, time::Duration};
use tokio::time::sleep;

#[tokio::test]
async fn wayback_suggestion() -> Result<(), Error> {
let url = &"https://example.com".try_into().unwrap();
let response = get_wayback_link(url).await?;
let suggestion = response.unwrap();

assert!(suggestion.as_str().contains("web.archive.org"));
async fn wayback_suggestion() -> Result<(), Box<dyn StdError>> {
let url = "https://example.com".parse()?;

Ok(())
// This test can be flaky, because the wayback machine does not always
// return a suggestion. Retry a few times if needed.
for _ in 0..3 {
if let Some(suggestion) = get_wayback_link(&url).await? {
assert_eq!(
suggestion
.host_str()
.expect("Suggestion doesn't have a host"),
"web.archive.org"
);
assert!(suggestion.path().ends_with(url.as_str()));
return Ok(());
}
sleep(Duration::from_secs(1)).await; // add delay between retries
}
Err("Did not get a valid Wayback Machine suggestion.".into())
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion lychee-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ip_network = "0.4.1"
jwalk = "0.8.1"
linkify = "0.10.0"
log = "0.4.19"
octocrab = "0.28.0"
octocrab = "0.29.1"
once_cell = "1.18.0"
openssl-sys = { version = "0.9.90", optional = true }
path-clean = "1.0.1"
Expand Down
Loading