Skip to content

Commit d8bdf97

Browse files
strulovichfacebook-github-bot
authored andcommitted
Try to fix issue with MainTest.file is modified if it is not formatted (#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
1 parent edf278c commit d8bdf97

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/src/test/java/com/facebook/ktfmt/cli/MainTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ class MainTest {
188188

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

0 commit comments

Comments
 (0)