twalthr commented on a change in pull request #18427:
URL: https://github.com/apache/flink/pull/18427#discussion_r794288516
##########
File path:
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/utils/TableTestBase.scala
##########
@@ -795,19 +797,20 @@ abstract class TableTestUtilBase(test: TableTestBase,
isStreamingMode: Boolean)
val plannerDirPath =
clazz.getResource("/").getFile.replace("/target/test-classes/", "")
new File(s"$plannerDirPath/src/test/resources$resourceTestFilePath")
}
- if (file.exists()) {
+ if (!file.exists() ||
"true".equalsIgnoreCase(System.getenv(PLAN_TEST_FORCE_OVERWRITE))) {
+ Files.deleteIfExists(file.toPath)
+ file.getParentFile.mkdirs()
+ assertTrue(file.createNewFile())
+ val prettyJson = TableTestUtil.getPrettyJson(jsonPlanWithoutFlinkVersion)
+ Files.write(Paths.get(file.toURI), prettyJson.getBytes)
Review comment:
Use `Paths.get(file.toURI)` also for deletion? I think it has proven to
work in all setups.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]