Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.apache.druid.indexing.overlord.TestTaskRunner;
import org.apache.druid.indexing.worker.config.WorkerConfig;
import org.apache.druid.java.util.common.FileUtils;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.http.client.response.StringFullResponseHolder;
import org.apache.druid.query.policy.NoopPolicyEnforcer;
import org.apache.druid.rpc.HttpResponseException;
Expand Down Expand Up @@ -309,6 +310,13 @@ public void testTaskRun() throws Exception
Assertions.assertNotNull(update4.getTaskAnnouncement().getTaskLocation().getHost());
}

@Test
public void testAssignTaskWithMaxLengthTaskId() throws Exception
{
workerTaskManager.start();
Assertions.assertDoesNotThrow(() -> workerTaskManager.assignTask(createNoopTask(StringUtils.repeat("x", 255))));
}

@Test
@Timeout(value = 30_000L, unit = TimeUnit.MILLISECONDS)
public void testTaskStatusWhenTaskRunnerFutureThrowsException() throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public static <T> T writeAtomically(final File file, OutputStreamConsumer<T> f)
*/
public static <T> T writeAtomically(final File file, final File tmpDir, OutputStreamConsumer<T> f) throws IOException
{
final File tmpFile = new File(tmpDir, StringUtils.format(".%s.%s", file.getName(), UUID.randomUUID()));
final File tmpFile = new File(tmpDir, "." + UUID.randomUUID());

//noinspection unused
try (final Closeable ignoredDeleter = () -> Files.deleteIfExists(tmpFile.toPath())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ public void testWriteAtomically() throws IOException
Assertions.assertEquals("baz", StringUtils.fromUtf8(Files.readAllBytes(tmpFile.toPath())));
}

@Test
public void testWriteAtomicallyMaxLengthFileName() throws IOException
{
final File file = new File(temporaryFolder.getRoot(), StringUtils.repeat("a", 255));
FileUtils.writeAtomically(file, out -> true);
Assertions.assertTrue(file.exists());
}

@Test
public void testResolveFileWithinDirectory()
{
Expand Down
Loading