You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "DomGarguilo (via GitHub)" <gi...@apache.org> on 2023/02/01 21:02:19 UTC

[GitHub] [accumulo] DomGarguilo commented on a diff in pull request #3177: Validate Property Values

DomGarguilo commented on code in PR #3177:
URL: https://github.com/apache/accumulo/pull/3177#discussion_r1093709949


##########
server/base/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java:
##########
@@ -74,7 +76,13 @@ private static String validateSystemProperty(String property, final String value
     if (!Property.isValidZooPropertyKey(property)) {
       IllegalArgumentException iae =
           new IllegalArgumentException("Zookeeper property is not mutable: " + property);
-      log.debug("Attempted to set zookeeper property.  It is not mutable", iae);
+      log.debug("Encountered error setting zookeeper property", iae);

Review Comment:
   `log.error` might be fitting for these



##########
core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java:
##########
@@ -88,13 +88,80 @@ public void testPorts() {
     for (Property prop : Property.values()) {
       if (prop.getType().equals(PropertyType.PORT)) {
         int port = Integer.parseInt(prop.getDefaultValue());
+        assertTrue(Property.isValidProperty(prop.getKey(), Integer.toString(port)));
         assertFalse(usedPorts.contains(port), "Port already in use: " + port);
         usedPorts.add(port);
         assertTrue(port > 1023 && port < 65536, "Port out of range of valid ports: " + port);
       }
     }
   }
 
+  @Test
+  public void testPropertyValidation() {
+
+    for (Property property : Property.values()) {
+      PropertyType propertyType = property.getType();
+      String invalidValue, validValue = property.getDefaultValue();
+      System.out.printf("Testing property: %s with type: %s\n", property.getKey(), propertyType);

Review Comment:
   Should we be using a `Logger` here instead of `System.out`?



##########
test/src/main/java/org/apache/accumulo/test/NamespacesIT.java:
##########
@@ -263,6 +263,20 @@ public void deleteNonEmptyNamespace() throws Exception {
     assertThrows(NamespaceNotEmptyException.class, () -> c.namespaceOperations().delete(namespace));
   }
 
+  @Test
+  public void setProperties() throws Exception {
+    String namespace = "nsTest";
+    c.namespaceOperations().create(namespace);

Review Comment:
   Any reason not to use the `namespace` String that is already created before 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: notifications-unsubscribe@accumulo.apache.org

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