Skip to content

pr: Check the correct timestamp in test_with_pr_core_utils_tests#6010

Merged
tertsdiepraam merged 1 commit intouutils:mainfrom
BenWiederhake:dev-pr-fix-flaky-diff-timestamp
Feb 25, 2024
Merged

pr: Check the correct timestamp in test_with_pr_core_utils_tests#6010
tertsdiepraam merged 1 commit intouutils:mainfrom
BenWiederhake:dev-pr-fix-flaky-diff-timestamp

Conversation

@BenWiederhake
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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
@BenWiederhake BenWiederhake deleted the dev-pr-fix-flaky-diff-timestamp branch February 25, 2024 10:47
@sylvestre
Copy link
Copy Markdown
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