Skip to content

Commit

Permalink
Try to fix issue with MainTest.file is modified if it is not formatted (
Browse files Browse the repository at this point in the history
#309)

Summary:
Pull Request resolved: #309

GitHub actions are failing on this test case:
https://github.com/facebookincubator/ktfmt/runs/6005912425?check_suite_focus=true#step:4:93991

Looks like recent optimizations, and a different order of running stuff can make this test run too fast? I'm not sure, but I'm going to give this a try. If not, I'll run some other debugging ideas for this test.

Reviewed By: cgrushko

Differential Revision: D35611158

fbshipit-source-id: 816cecf57ba0b8451bdfe6d5f4122b707cc17c57
  • Loading branch information
strulovich authored and facebook-github-bot committed Apr 13, 2022
1 parent edf278c commit d8bdf97
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/test/java/com/facebook/ktfmt/cli/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ class MainTest {

val lastModifiedTimeBeforeRunningFormatter =
Files.getLastModifiedTime(unformattedFilePath).toMillis()
// The test may run under 1ms, and we need to make sure the new file timestamp will be different
Thread.sleep(100)
Main(emptyInput, PrintStream(out), PrintStream(err), arrayOf(unformattedFile.toString())).run()
val lastModifiedTimeAfterRunningFormatter =
Files.getLastModifiedTime(unformattedFilePath).toMillis()
Expand Down

0 comments on commit d8bdf97

Please sign in to comment.