Skip to content

Add tests for limits #649

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 5 commits into from
Mar 30, 2020
Merged

Add tests for limits #649

merged 5 commits into from
Mar 30, 2020

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Mar 21, 2020

We had a queue backup this morning because the builder would panic whenever a crate had limits set (#648, https://docs.rs/releases/queue). This adds tests so that doesn't happen again.

r? @kvrhdn

@yvrhdn
Copy link

yvrhdn commented Mar 23, 2020

I should be able to look at this in the next couple of days @jyn514.

Copy link

@yvrhdn yvrhdn left a comment

Choose a reason for hiding this comment

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

Sorry for the really long lead time on this fairly small review... 😓

This looks good to me. The tests are easy to follow and cover the essential cases.

Just a small note would be: the display_limits test does not test all the different labels related to converting bytes into MB etc. We can improve the coverage by testing more unit values.
A simple change would be to tweak the test a bit to, for instance, pick a size of the build log in KB and the value of available RAM in GB? Alternatively, we could also write a test for scale specifically.

This also rounds to the closest value instead of truncating.
@jyn514
Copy link
Member Author

jyn514 commented Mar 27, 2020

Good idea! I added a test for scale and noticed at the same time that it always rounded down. I changed it so now it rounds to the closest integer instead. I was also considering printing a float rounded to 1 decimal place, what do you think?

@yvrhdn
Copy link

yvrhdn commented Mar 27, 2020

Yeah, makes sense! Having one digit after the decimal point provides a lot more precision. There is a significant difference between 1 GB and 1.5 GB. But at the same time, I find it difficult to reason about 1.2 hour. So it will be a bit of a trade off 😅

@jyn514
Copy link
Member Author

jyn514 commented Mar 28, 2020

Implemented fractional precision up to 1 decimal point. I also displayed it as an integer if the decimal was 0 (2.0 -> 2).

@yvrhdn
Copy link

yvrhdn commented Mar 28, 2020

But overall this looks neat 👍 I love Rust's format!!

@jyn514
Copy link
Member Author

jyn514 commented Mar 28, 2020

Rust is indeed wonderful! Thanks for the review, I think the new precision will be helpful :)

@jyn514 jyn514 merged commit d60e54f into rust-lang:master Mar 30, 2020
@jyn514 jyn514 deleted the limits branch March 30, 2020 00:48
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.

3 participants