static void createUploadDir(
            final Path uploadDir, final Logger log, final boolean initialCreation)
            throws IOException {
        if (!Files.exists(uploadDir)) {
            if (initialCreation) {
                log.info("Upload directory {} does not exist. ", uploadDir);
            } else {
                log.warn(
                        "Upload directory {} has been deleted externally. "
                                + "Previously uploaded files are no longer available.",
                        uploadDir);
            }
            checkAndCreateUploadDir(uploadDir, log);
        }
    }
@Tag("org.apache.flink.testutils.junit.FailsInGHAContainerWithRootUser")
    @Test
    void testCreateUploadDirFails(@TempDir File file) throws Exception {
        assertThat(file.setWritable(false));

        final Path testUploadDir = file.toPath().resolve("testUploadDir");
        assertThat(Files.exists(testUploadDir)).isFalse();

        assertThatThrownBy(
                        () ->
                                RestServerEndpoint.createUploadDir(
                                        testUploadDir, NOPLogger.NOP_LOGGER, true))
                .isInstanceOf(IOException.class);
    }