You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/12/11 17:06:21 UTC

[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #6326: pinot-controller unit test suite.

mayankshriv commented on a change in pull request #6326:
URL: https://github.com/apache/incubator-pinot/pull/6326#discussion_r541089382



##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/LeadControllerManagerTest.java
##########
@@ -73,7 +73,7 @@ public void setup() {
   @Test
   public void testLeadControllerManager() {
     LeadControllerManager leadControllerManager = new LeadControllerManager(_helixManager, _controllerMetrics);
-    String tableName = "testTable";
+    String tableName = "leadTable";

Review comment:
       Nit: s/leadTable/leadControllerTestTable?

##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/api/AccessControlTest.java
##########
@@ -19,49 +19,40 @@
 package org.apache.pinot.controller.api;
 
 import java.io.IOException;
-import java.util.Map;
-
-import org.apache.pinot.controller.ControllerConf;
 import org.apache.pinot.controller.api.access.AccessControl;
 import org.apache.pinot.controller.api.access.AccessControlFactory;
-import org.apache.pinot.controller.helix.ControllerTest;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import static org.apache.pinot.controller.ControllerTestUtils.*;

Review comment:
       Lets avoid `static` import, if possible.

##########
File path: pom.xml
##########
@@ -1095,7 +1095,7 @@
       <dependency>
         <groupId>org.apache.maven.surefire</groupId>
         <artifactId>surefire-testng</artifactId>
-        <version>2.19</version>
+        <version>3.0.0-M5</version>

Review comment:
       Some comment on why this upgrade was need would be good.

##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotInstanceAssignmentRestletResourceTest.java
##########
@@ -23,77 +23,67 @@
 import java.util.Collections;
 import java.util.Map;
 import java.util.TreeMap;
-import java.util.concurrent.TimeUnit;
 import org.apache.pinot.common.assignment.InstancePartitions;
 import org.apache.pinot.common.utils.config.TagNameUtils;
-import org.apache.pinot.controller.ControllerConf;
-import org.apache.pinot.controller.helix.ControllerTest;
 import org.apache.pinot.core.realtime.impl.fakestream.FakeStreamConfigUtils;
 import org.apache.pinot.spi.config.table.TableConfig;
 import org.apache.pinot.spi.config.table.TableType;
-import org.apache.pinot.spi.config.tenant.Tenant;
-import org.apache.pinot.spi.config.tenant.TenantRole;
 import org.apache.pinot.spi.config.table.assignment.InstanceAssignmentConfig;
 import org.apache.pinot.spi.config.table.assignment.InstancePartitionsType;
 import org.apache.pinot.spi.config.table.assignment.InstanceReplicaGroupPartitionConfig;
 import org.apache.pinot.spi.config.table.assignment.InstanceTagPoolConfig;
-import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.config.tenant.Tenant;
+import org.apache.pinot.spi.config.tenant.TenantRole;
 import org.apache.pinot.spi.data.FieldSpec.DataType;
 import org.apache.pinot.spi.data.Schema;
-import org.apache.pinot.spi.data.TimeGranularitySpec;
 import org.apache.pinot.spi.utils.JsonUtils;
 import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
 import org.apache.pinot.spi.utils.builder.TableNameBuilder;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.apache.pinot.controller.ControllerTestUtils.*;

Review comment:
       Same here, and other such cases.

##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/api/AccessControlTest.java
##########
@@ -19,49 +19,40 @@
 package org.apache.pinot.controller.api;
 
 import java.io.IOException;
-import java.util.Map;
-
-import org.apache.pinot.controller.ControllerConf;
 import org.apache.pinot.controller.api.access.AccessControl;
 import org.apache.pinot.controller.api.access.AccessControlFactory;
-import org.apache.pinot.controller.helix.ControllerTest;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import static org.apache.pinot.controller.ControllerTestUtils.*;
 
-public class AccessControlTest extends ControllerTest {
 
-  @BeforeClass
-  public void setUp() {
-    startZk();
-    
-    Map<String, Object> properties = getDefaultControllerConfiguration();
-    properties.put(ControllerConf.ACCESS_CONTROL_FACTORY_CLASS, DenyAllAccessFactory.class.getName());
+public class AccessControlTest {
+
+  private static final String TABLE_NAME = "accessTestTable";
 
-    startController(properties);
+  @BeforeClass
+  public void setUp() throws Exception {
+    validate();

Review comment:
       This is somewhat confusing to read - why does setup() call something named validate(), instead of setting up the cluster? One has to go to inside validate() to figure out what is going.
   
   Perhaps it can be named `setupClusterAndValidate()`, or something more readable?

##########
File path: pinot-controller/testng-old-tests.xml
##########
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<!--
+
+    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.
+
+-->
+<suite name="testng.suite-controller-old">

Review comment:
       `old` not a great name :-(. Perhaps name according to what characteristic classifies the test to be in one suite over the other? Same with the name of xml file (`testng-old-test.xml`).




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org