kfaraz commented on code in PR #18950:
URL: https://github.com/apache/druid/pull/18950#discussion_r2773283407


##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/NativeCompactionTaskRunTest.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.task;
+
+import org.apache.druid.client.indexing.ClientCompactionTaskGranularitySpec;
+import org.apache.druid.indexing.common.LockGranularity;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.java.util.common.granularity.Granularity;
+import org.joda.time.Interval;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@RunWith(Parameterized.class)
+public class NativeCompactionTaskRunTest extends CompactionTaskRunBase
+{
+  @Parameterized.Parameters(name = "name={0}, inputInterval={5}, 
segmentGran={6}")
+  public static Iterable<Object[]> constructorFeeder()
+  {
+    final List<Object[]> constructors = new ArrayList<>();
+
+    for (LockGranularity lockGranularity : new 
LockGranularity[]{LockGranularity.TIME_CHUNK, LockGranularity.SEGMENT}) {
+      for (boolean useCentralizedDatasourceSchema : new boolean[]{true}) {
+        for (boolean batchSegmentAllocation : new boolean[]{true}) {
+          for (boolean useSegmentMetadataCache : new boolean[]{false, true}) {
+            for (boolean useConcurrentLocks : new boolean[]{false, true}) {
+              for (Interval inputInterval : new Interval[]{TEST_INTERVAL, 
TEST_INTERVAL_DAY}) {
+                for (Granularity segmentGran : new Granularity[]{null, 
Granularities.HOUR, Granularities.SIX_HOUR}) {

Review Comment:
   The 7-level for loops look really weird and make reading the test cases 
difficult.
   
   Given that some params are deprecated and some params are independent of 
each other, you can greatly reduce the number of test cases to keep only those 
that add real value.
   For example, you need not test out segment locking with concurrent locks or 
segment metadata cache.
   Then you could just list out the test cases in separate lines.
   
   ---
   
   Alternatively, you could consider adding a small utility class which 
generates the parameters, but I suppose this need not be done in this PR itself.
   
   It could have a syntax like (I don't know if JUnit already has a class like 
this):
   
   ```
   final List<Object[]> testCases = new TestCaseGenerator()
         .withParam("batchSegmentAllocation", true)
         .withParam("useSegmentMetadataCache", true, false)
         .withParam("inputInterval", INTERVAL_1, INTERVAL_2)
         .generateWithName();
   ```



-- 
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]

Reply via email to