fix IndexTaskTest tmp dir

- Create local firehose files in a clean temp directory to avoid
firehose reading other random temp files that start with 'druid'
This commit is contained in:
Xavier Léauté 2014-12-12 17:05:40 -08:00
parent 016d07fda3
commit 092dfe0309
1 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@
package io.druid.indexing.common.task; package io.druid.indexing.common.task;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.io.Files;
import com.metamx.common.Granularity; import com.metamx.common.Granularity;
import io.druid.data.input.impl.CSVParseSpec; import io.druid.data.input.impl.CSVParseSpec;
import io.druid.data.input.impl.DimensionsSpec; import io.druid.data.input.impl.DimensionsSpec;
@ -57,7 +58,10 @@ public class IndexTaskTest
@Test @Test
public void testDeterminePartitions() throws Exception public void testDeterminePartitions() throws Exception
{ {
File tmpFile = File.createTempFile("druid", "index"); File tmpDir = Files.createTempDir();
tmpDir.deleteOnExit();
File tmpFile = File.createTempFile("druid", "index", tmpDir);
tmpFile.deleteOnExit(); tmpFile.deleteOnExit();
PrintWriter writer = new PrintWriter(tmpFile); PrintWriter writer = new PrintWriter(tmpFile);
@ -97,7 +101,7 @@ public class IndexTaskTest
), ),
new IndexTask.IndexIOConfig( new IndexTask.IndexIOConfig(
new LocalFirehoseFactory( new LocalFirehoseFactory(
tmpFile.getParentFile(), tmpDir,
"druid*", "druid*",
null null
) )