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

pr: Check the correct timestamp in test_with_pr_core_utils_tests #6010

Merged

Conversation

BenWiederhake
Copy link
Collaborator

The test test_pr::test_with_pr_core_utils_tests is flaky, and causes real problems.

Here's a branch that makes the bug 100% reproducible, by injecting "lag" at critical moments: https://github.com/BenWiederhake/coreutils-rs/tree/historic/demo-pr-test-race

The bug is best explained by the fix:

     let input_file_path = input_file.first().unwrap();
     let test_file_path = expected_file.first().unwrap();
-    let value = file_last_modified_time(&scenario, test_file_path);
+    let value = file_last_modified_time(&scenario, input_file_path);
     let mut arguments: Vec<&str> = …;
     arguments.extend(input_file.clone());
     // "value" is then used to construct the expected output.

In other words: value is the last modified time of the wrong file.

All other tests in test_pr seem to use the correct file, so this should fix this issue for good.

@tertsdiepraam
Copy link
Member

Whoa, great job finding the issue here! Seeing the CI green is so nice!

@tertsdiepraam tertsdiepraam merged commit d7a09c0 into uutils:main Feb 25, 2024
62 checks passed
@BenWiederhake BenWiederhake deleted the dev-pr-fix-flaky-diff-timestamp branch February 25, 2024 10:47
@sylvestre
Copy link
Sponsor Contributor

+1!

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