-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make some blocking tests non-blocking #11650
Conversation
@ehuss Do you think this is reasonable? |
Just checking in @hi-rustin if you had any questions. I think enabling the API for publish is probably the right way to go. |
Yeah, I am going to fix some tests that do not need to check the content first. Then I will make the HTTP mock server support assert its content to support other tests. |
59a3a7b
to
0c513e4
Compare
I would prefer to not remove test coverage just to merge a PR sooner. For the tests that want to validate the JSON of the API request, I would suggest doing the following: Factor out the code from In tests, add a responder to the registry builder: .add_responder("/api/v1/crates/new",
validate_api_publish(
r#"{
"authors": [],
...
}"#,
"foo-0.0.1.crate",
&["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"],
)) The fn validate_publish(...) -> impl Fn(&Request, &HttpServer) -> Response {
|request, server| -> Response {
// code here should take request.body and feed that into _validate_upload
// and return the appropriate response
server.ok(request)
}
} Let me know if you have any questions or thoughts on that approach. |
Sorry I wasn't clear, my current changes are for tests that don't require checking content. Because they don't have any specificity in their content. We can just check it via stdout. So I think these changes sould not change any test coverages. But if you prefer, we can include any changes in this PR. That's fine with me. |
Thanks a lot! I'll try it. |
@rustbot author |
af6975a
to
dbf009c
Compare
@ehuss I added But I found if we use Do you have any suggestions about how to fix it? |
Oh, that's unfortunate! Ok, new strategy: In |
Yes. I think it would work. I'll try it tomorrow. Thanks! |
a34cbc0
to
155906c
Compare
@rustbot ready |
For CI failed, see more at zulip. |
d436103
to
155906c
Compare
8357993
to
5751e17
Compare
Thanks for your review! 💚 💙 💜 💛 ❤️ |
|
||
// Now perform the actual publish | ||
p.cargo("publish --registry alternative").run(); | ||
|
||
validate_alt_upload( |
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.
Can you say why this validation was removed? I would not expect it to be removed.
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.
sigh I was specifically looking for any still removed and missed this. Thanks for spotting it!
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.
@hi-rustin Can you post a PR to return the publish_to_alt_registry
test so that it validates the upload?
☀️ Test successful - checks-actions |
1 similar comment
☀️ Test successful - checks-actions |
👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request. |
@hi-rustin Were your concerns about the order of the output in |
I didn't meet it anymore after I updated the output and rebased from the master branch.
It's always been stable on my computer. It's only in CI that I've encountered instability. But the past few tests have passed stably. I'm not quite sure what exactly is affecting it. Maybe there was a mistake in my code at the time. I'll keep watching. I'll keep trying to fix it if there's a problem. |
Fix tests with nondeterministic ordering A couple tests updated in #11650 started using curl's http API. It appears to have a nondeterministic order for when crates will finish downloading. This addresses it by ignoring the order, which is not important for these tests.
10 commits in 9d5b32f503fc099c4064298465add14d4bce11e6..9880b408a3af50c08fab3dbf4aa2a972df71e951 2023-02-22 23:04:16 +0000 to 2023-02-28 19:39:39 +0000 - bump jobserver to respect `--jobserver-auth=fifo:PATH` (rust-lang/cargo#11767) - Addition of support for -F as an alias for --features (rust-lang/cargo#11774) - Added documentation for the configuration discovery of `cargo install` to the man pages (rust-lang/cargo#11763) - Fix Cargo removing the sparse+ prefix from sparse URLs in .crates.toml (rust-lang/cargo#11756) - Fix warning with tempfile (rust-lang/cargo#11771) - Error message for transitive artifact dependencies with targets the package doesn't directly interact with (rust-lang/cargo#11643) - Fix tests with nondeterministic ordering (rust-lang/cargo#11766) - Make some blocking tests non-blocking (rust-lang/cargo#11650) - Suggest cargo add when installing library crate (rust-lang/cargo#11410) - chore: bump is-terminal to 0.4.4 (rust-lang/cargo#11759)
Update cargo 10 commits in 9d5b32f503fc099c4064298465add14d4bce11e6..9880b408a3af50c08fab3dbf4aa2a972df71e951 2023-02-22 23:04:16 +0000 to 2023-02-28 19:39:39 +0000 - bump jobserver to respect `--jobserver-auth=fifo:PATH` (rust-lang/cargo#11767) - Addition of support for -F as an alias for --features (rust-lang/cargo#11774) - Added documentation for the configuration discovery of `cargo install` to the man pages (rust-lang/cargo#11763) - Fix Cargo removing the sparse+ prefix from sparse URLs in .crates.toml (rust-lang/cargo#11756) - Fix warning with tempfile (rust-lang/cargo#11771) - Error message for transitive artifact dependencies with targets the package doesn't directly interact with (rust-lang/cargo#11643) - Fix tests with nondeterministic ordering (rust-lang/cargo#11766) - Make some blocking tests non-blocking (rust-lang/cargo#11650) - Suggest cargo add when installing library crate (rust-lang/cargo#11410) - chore: bump is-terminal to 0.4.4 (rust-lang/cargo#11759) r? `@ghost`
Signed-off-by: hi-rustin rustin.liu@gmail.com
What does this PR try to resolve?
close #11615
Make some blocking tests non-blocking.
Check the unit tests.
Additional information
None
r? @ehuss