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

Fix retries #1573

Merged
merged 5 commits into from
Nov 27, 2024
Merged

Fix retries #1573

merged 5 commits into from
Nov 27, 2024

Conversation

trask
Copy link
Contributor

@trask trask commented Nov 26, 2024

I'm not seeing any retries.

I'm very new to rust, so probably missing how it's supposed to work, but this change made retries work for me.

@trask trask marked this pull request as ready for review November 26, 2024 02:43
@mre
Copy link
Member

mre commented Nov 26, 2024

Thanks for the PR! Makes sense.
Can you add a test to check that it works?
Ideally, a unit test in the same file and an integration test in https://github.com/lycheeverse/lychee/blob/master/lychee-bin/tests/cli.rs. The integration test can be modeled after the existing tests. For example, you can use a mock http server as in this test:

#[tokio::test]
async fn test_stdin_input_failure() {
let mut cmd = main_command();
let mock_server = mock_server!(StatusCode::INTERNAL_SERVER_ERROR);
cmd.arg("-")
.write_stdin(mock_server.uri())
.assert()
.failure()
.code(2);
}

The unit test would be about creating a new status object and checking that it returns the correct result when calling should_retry() on it. For some reason, we don't have unit tests for that yet (hence why it's probably broken), but it's a great opportunity to change that. 😉

@trask
Copy link
Contributor Author

trask commented Nov 27, 2024

unit test and integration test added!

@mre
Copy link
Member

mre commented Nov 27, 2024

Brilliant! Thanks for the quick turnaround and for the clean implementation.

@mre mre merged commit 034fd12 into lycheeverse:master Nov 27, 2024
7 checks passed
@trask trask deleted the fix-retries branch November 27, 2024 21:59
@mre mre mentioned this pull request Nov 26, 2024
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.

2 participants