FrankChen021 commented on code in PR #19920:
URL: https://github.com/apache/druid/pull/19920#discussion_r3739910693
##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java:
##########
@@ -104,67 +98,69 @@
IndexTask.IndexTuningConfig.class
);
- Assert.assertEquals(10, (int) tuningConfig.getMaxRowsPerSegment());
- Assert.assertNull(tuningConfig.getNumShards());
+ Assertions.assertEquals(10, (int) tuningConfig.getMaxRowsPerSegment());
Review Comment:
Replaced the deprecated IndexTuningConfig.getMaxRowsPerSegment() call with a
helper that reads PartitionsSpec.getMaxRowsPerSegment() directly. Legacy JSON
deserialization remains unchanged.
##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java:
##########
@@ -104,67 +98,69 @@
IndexTask.IndexTuningConfig.class
);
- Assert.assertEquals(10, (int) tuningConfig.getMaxRowsPerSegment());
- Assert.assertNull(tuningConfig.getNumShards());
+ Assertions.assertEquals(10, (int) tuningConfig.getMaxRowsPerSegment());
Review Comment:
Replaced the deprecated IndexTuningConfig.getMaxRowsPerSegment() call with a
helper that reads PartitionsSpec.getMaxRowsPerSegment() directly. Legacy JSON
deserialization remains unchanged.
##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java:
##########
@@ -56,15 +54,19 @@ public class AbstractTaskTest
{
private ObjectMapper objectMapper;
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Before
+ @BeforeEach
public void setup()
{
objectMapper = new TestUtils().getTestObjectMapper();
}
+ private static File createTempReportFile() throws Exception
+ {
+ final File reportsFile = new
File(org.apache.druid.java.util.common.FileUtils.createTempDir(),
"report.json");
+ FileUtils.write(reportsFile, "", StandardCharsets.UTF_8);
+ return reportsFile;
Review Comment:
Reused a test-owned base directory and delete it in @AfterEach instead of
creating an untracked base directory for each test.
##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java:
##########
@@ -104,67 +98,69 @@
IndexTask.IndexTuningConfig.class
);
- Assert.assertEquals(10, (int) tuningConfig.getMaxRowsPerSegment());
- Assert.assertNull(tuningConfig.getNumShards());
+ Assertions.assertEquals(10, (int) tuningConfig.getMaxRowsPerSegment());
Review Comment:
Replaced the deprecated IndexTuningConfig.getMaxRowsPerSegment() call with a
helper that reads PartitionsSpec.getMaxRowsPerSegment() directly. Legacy JSON
deserialization remains unchanged.
##########
indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java:
##########
@@ -1022,7 +1017,7 @@ private void persistSegment(List<InputRow> rows) throws
IOException
.rows(rows)
.buildIncrementalIndex();
- segmentDirectory = temporaryFolder.newFolder();
+ segmentDirectory = FileUtils.createTempDir();
Review Comment:
Added per-test cleanup for segmentDirectory with an @AfterEach method so the
persisted segment is removed after each test.
##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java:
##########
@@ -56,15 +54,19 @@ public class AbstractTaskTest
{
private ObjectMapper objectMapper;
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Before
+ @BeforeEach
public void setup()
{
objectMapper = new TestUtils().getTestObjectMapper();
}
+ private static File createTempReportFile() throws Exception
+ {
+ final File reportsFile = new
File(org.apache.druid.java.util.common.FileUtils.createTempDir(),
"report.json");
+ FileUtils.write(reportsFile, "", StandardCharsets.UTF_8);
+ return reportsFile;
Review Comment:
Reused a test-owned base directory and delete it in @AfterEach instead of
creating an untracked base directory for each test.
##########
indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java:
##########
@@ -1022,7 +1017,7 @@ private void persistSegment(List<InputRow> rows) throws
IOException
.rows(rows)
.buildIncrementalIndex();
- segmentDirectory = temporaryFolder.newFolder();
+ segmentDirectory = FileUtils.createTempDir();
Review Comment:
Added per-test cleanup for segmentDirectory with an @AfterEach method so the
persisted segment is removed after each test.
##########
indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java:
##########
@@ -1022,7 +1017,7 @@ private void persistSegment(List<InputRow> rows) throws
IOException
.rows(rows)
.buildIncrementalIndex();
- segmentDirectory = temporaryFolder.newFolder();
+ segmentDirectory = FileUtils.createTempDir();
Review Comment:
Added per-test cleanup for segmentDirectory with an @AfterEach method so the
persisted segment is removed after each test.
##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java:
##########
@@ -56,15 +54,19 @@ public class AbstractTaskTest
{
private ObjectMapper objectMapper;
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Before
+ @BeforeEach
public void setup()
{
objectMapper = new TestUtils().getTestObjectMapper();
}
+ private static File createTempReportFile() throws Exception
+ {
+ final File reportsFile = new
File(org.apache.druid.java.util.common.FileUtils.createTempDir(),
"report.json");
+ FileUtils.write(reportsFile, "", StandardCharsets.UTF_8);
+ return reportsFile;
Review Comment:
Reused a test-owned base directory and delete it in @AfterEach instead of
creating an untracked base directory for each test.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]