-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
tests/du: run test_du_time with TZ=UTC. #4446
Conversation
Fixed linter errors (hopefully). |
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.
This makes sense, though it is a bit unfortunate that we have to do it this way, because now everyone can only test their own timezone. It would be better if we could specify the timezone in the test somehow. I wonder if that's possible.
GNU testsuite comparison:
|
I could implement support for the TZ environment variable in Testing this on a UTC Linux system:
What do you think? |
That should actually already work! That's because
So maybe we run the tests with |
I've changed this specific test to set |
Nice! That's indeed what I meant. |
GNU testsuite comparison:
|
Great! And after another encounter with the linter, this should be good now. |
Looks great! Could you add a comment on why it was necessary to add that variable for people who read the code without the context of the issue or this PR? |
du --time formats a file's timestamp according to the local timezone, but the test implicitly assumed UTC. This caused it to fail when running locally in my UTC+1 machine. $ cargo test --features "du touch" --no-default-features Failure: https://gist.github.com/eggpi/651e01559b7c59e9457c1b22fe4c0c19
Sure thing, done! |
thanks |
Hi,
When running tests locally, I noticed that
test_du_time
fails because it expects the output to be 1h offset from what the tool produces:I believe the test assumes it is running on a machine with UTC timezone. I am in UTC + 1, which the tool output is correctly aware of. This PR changes the test to also expect local times.
Apologies if this is not very idiomatic, I am fairly new to Rust and obviously open to iterating on this 😄
Thanks in advance for the review!