kevinrr888 commented on code in PR #5740:
URL: https://github.com/apache/accumulo/pull/5740#discussion_r2216056701


##########
core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java:
##########
@@ -170,46 +202,83 @@ public void testAllColumns() {
     mutation.put(ExternalCompactionColumnFamily.STR_NAME, ecid.canonical(), 
ecMeta.toJson());
 
     TServerInstance tsi = new TServerInstance("localhost:9997", 5000L);
+
     MIGRATION_COLUMN.put(mutation, new Value(tsi.getHostPortSession()));
 
     SortedMap<Key,Value> rowMap = toRowMap(mutation);
 
     TabletMetadata tm = TabletMetadata.convertRow(rowMap.entrySet().iterator(),
         EnumSet.allOf(ColumnType.class), true, false);
 
+    assertTrue(tm.getCompacted().isEmpty());
+    allColumns.remove(COMPACTED);

Review Comment:
   Would be better to add something to this column and ensure that it exists



##########
core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java:
##########
@@ -170,46 +202,83 @@ public void testAllColumns() {
     mutation.put(ExternalCompactionColumnFamily.STR_NAME, ecid.canonical(), 
ecMeta.toJson());
 
     TServerInstance tsi = new TServerInstance("localhost:9997", 5000L);
+
     MIGRATION_COLUMN.put(mutation, new Value(tsi.getHostPortSession()));
 
     SortedMap<Key,Value> rowMap = toRowMap(mutation);
 
     TabletMetadata tm = TabletMetadata.convertRow(rowMap.entrySet().iterator(),
         EnumSet.allOf(ColumnType.class), true, false);
 
+    assertTrue(tm.getCompacted().isEmpty());
+    allColumns.remove(COMPACTED);
+    
assertEquals(TabletMergeabilityMetadata.fromValue(mergeabilityValue).toJson(),
+        
TabletMergeabilityMetadata.toValue(tm.getTabletMergeability()).toString());

Review Comment:
   ```suggestion
       assertEquals(TabletMergeabilityMetadata.fromValue(mergeabilityValue),
           tm.getTabletMergeability());
   ```
   Compares the objects directly instead of strings which is a bit nicer/safer



##########
core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java:
##########
@@ -170,46 +202,83 @@ public void testAllColumns() {
     mutation.put(ExternalCompactionColumnFamily.STR_NAME, ecid.canonical(), 
ecMeta.toJson());
 
     TServerInstance tsi = new TServerInstance("localhost:9997", 5000L);
+
     MIGRATION_COLUMN.put(mutation, new Value(tsi.getHostPortSession()));
 
     SortedMap<Key,Value> rowMap = toRowMap(mutation);
 
     TabletMetadata tm = TabletMetadata.convertRow(rowMap.entrySet().iterator(),
         EnumSet.allOf(ColumnType.class), true, false);
 
+    assertTrue(tm.getCompacted().isEmpty());
+    allColumns.remove(COMPACTED);
+    
assertEquals(TabletMergeabilityMetadata.fromValue(mergeabilityValue).toJson(),
+        
TabletMergeabilityMetadata.toValue(tm.getTabletMergeability()).toString());
+    allColumns.remove(MERGEABILITY);
+    assertEquals(TabletAvailability.ONDEMAND, tm.getTabletAvailability());
+    allColumns.remove(AVAILABILITY);
+    assertEquals(selectedPath.toString(),
+        tm.getSelectedFiles().getFiles().iterator().next().getMetadataPath());
+    allColumns.remove(SELECTED);
+    assertEquals(opidValue.toString(), tm.getOperationId().toString());
+    allColumns.remove(OPID);
+    assertFalse(tm.getHostingRequested());
+    allColumns.remove(HOSTING_REQUESTED);
+    assertEquals(1000L, tm.getSuspend().suspensionTime.getMillis());
+    allColumns.remove(SUSPEND);

Review Comment:
   ```suggestion
       assertEquals(suspensionTime, tm.getSuspend().suspensionTime);
       allColumns.remove(SUSPEND);
   ```



##########
core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java:
##########
@@ -170,46 +202,83 @@ public void testAllColumns() {
     mutation.put(ExternalCompactionColumnFamily.STR_NAME, ecid.canonical(), 
ecMeta.toJson());
 
     TServerInstance tsi = new TServerInstance("localhost:9997", 5000L);
+
     MIGRATION_COLUMN.put(mutation, new Value(tsi.getHostPortSession()));
 
     SortedMap<Key,Value> rowMap = toRowMap(mutation);
 
     TabletMetadata tm = TabletMetadata.convertRow(rowMap.entrySet().iterator(),
         EnumSet.allOf(ColumnType.class), true, false);
 
+    assertTrue(tm.getCompacted().isEmpty());
+    allColumns.remove(COMPACTED);
+    
assertEquals(TabletMergeabilityMetadata.fromValue(mergeabilityValue).toJson(),
+        
TabletMergeabilityMetadata.toValue(tm.getTabletMergeability()).toString());
+    allColumns.remove(MERGEABILITY);
+    assertEquals(TabletAvailability.ONDEMAND, tm.getTabletAvailability());
+    allColumns.remove(AVAILABILITY);
+    assertEquals(selectedPath.toString(),
+        tm.getSelectedFiles().getFiles().iterator().next().getMetadataPath());
+    allColumns.remove(SELECTED);
+    assertEquals(opidValue.toString(), tm.getOperationId().toString());
+    allColumns.remove(OPID);

Review Comment:
   Would like to see something like:
   ```
       assertEquals(opid, tm.getOperationId());
       allColumns.remove(OPID);
   ```
   So objects are compared directly instead of strings. Will have to change how 
the opid is constructed, see `TabletOperationId.from`



##########
core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java:
##########
@@ -170,46 +202,83 @@ public void testAllColumns() {
     mutation.put(ExternalCompactionColumnFamily.STR_NAME, ecid.canonical(), 
ecMeta.toJson());
 
     TServerInstance tsi = new TServerInstance("localhost:9997", 5000L);
+
     MIGRATION_COLUMN.put(mutation, new Value(tsi.getHostPortSession()));
 
     SortedMap<Key,Value> rowMap = toRowMap(mutation);
 
     TabletMetadata tm = TabletMetadata.convertRow(rowMap.entrySet().iterator(),
         EnumSet.allOf(ColumnType.class), true, false);
 
+    assertTrue(tm.getCompacted().isEmpty());
+    allColumns.remove(COMPACTED);
+    
assertEquals(TabletMergeabilityMetadata.fromValue(mergeabilityValue).toJson(),
+        
TabletMergeabilityMetadata.toValue(tm.getTabletMergeability()).toString());
+    allColumns.remove(MERGEABILITY);
+    assertEquals(TabletAvailability.ONDEMAND, tm.getTabletAvailability());
+    allColumns.remove(AVAILABILITY);
+    assertEquals(selectedPath.toString(),
+        tm.getSelectedFiles().getFiles().iterator().next().getMetadataPath());
+    allColumns.remove(SELECTED);
+    assertEquals(opidValue.toString(), tm.getOperationId().toString());
+    allColumns.remove(OPID);
+    assertFalse(tm.getHostingRequested());
+    allColumns.remove(HOSTING_REQUESTED);
+    assertEquals(1000L, tm.getSuspend().suspensionTime.getMillis());
+    allColumns.remove(SUSPEND);
     assertEquals("OK", tm.getCloned());
+    allColumns.remove(CLONED);
     assertEquals("t-0001757", tm.getDirName());
+    allColumns.remove(DIR);
     assertEquals(extent.endRow(), tm.getEndRow());
     assertEquals(extent, tm.getExtent());
     assertEquals(Set.of(tf1, tf2), Set.copyOf(tm.getFiles()));
+    allColumns.remove(FILES);
     assertEquals(Map.of(tf1, dfv1, tf2, dfv2), tm.getFilesMap());
     
assertEquals(tm.getFilesMap().values().stream().mapToLong(DataFileValue::getSize).sum(),
         tm.getFileSize());
     assertEquals(6L, tm.getFlushId().getAsLong());
+    allColumns.remove(FLUSH_ID);
     SortedMap<Key,Value> actualRowMap = tm.getKeyValues().stream().collect(
         Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> b, 
TreeMap::new));
     assertEquals(rowMap, actualRowMap);
     assertEquals(Map.of(new StoredTabletFile(bf1), fateId1, new 
StoredTabletFile(bf2), fateId2),
         tm.getLoaded());
+    allColumns.remove(LOADED);
     assertEquals(HostAndPort.fromParts("server1", 8555), 
tm.getLocation().getHostAndPort());
+    allColumns.remove(LOCATION);
     assertEquals("s001", tm.getLocation().getSession());
     assertEquals(LocationType.CURRENT, tm.getLocation().getType());
     assertTrue(tm.hasCurrent());
     assertEquals(HostAndPort.fromParts("server2", 8555), 
tm.getLast().getHostAndPort());
     assertEquals("s000", tm.getLast().getSession());
+    allColumns.remove(LAST);
     assertEquals(LocationType.LAST, tm.getLast().getType());
     assertEquals(Set.of(le1, le2), tm.getLogs().stream().collect(toSet()));
+    allColumns.remove(LOGS);
     assertEquals(extent.prevEndRow(), tm.getPrevEndRow());
+    allColumns.remove(PREV_ROW);
     assertEquals(extent.tableId(), tm.getTableId());
     assertTrue(tm.sawPrevEndRow());
     assertEquals("M123456789", tm.getTime().encode());
+    allColumns.remove(TIME);
     assertEquals(Set.of(sf1, sf2), Set.copyOf(tm.getScans()));
+    allColumns.remove(SCANS);
     assertTrue(tm.hasMerged());
+    allColumns.remove(MERGED);
     assertTrue(tm.getUserCompactionsRequested().contains(userCompactFateId));
+    allColumns.remove(USER_COMPACTION_REQUESTED);
     assertEquals(unsplittableMeta, tm.getUnSplittable());
+    allColumns.remove(UNSPLITTABLE);
     assertEquals(ecMeta.toJson(), 
tm.getExternalCompactions().get(ecid).toJson());
+    allColumns.remove(ECOMP);
     assertEquals(10, tm.getFlushNonce().getAsLong());
+    allColumns.remove(FLUSH_NONCE);
     assertEquals(tsi, tm.getMigration());
+    allColumns.remove(MIGRATION);
+
+    assertTrue(allColumns.isEmpty(),
+        "Not all columns are testing. Add testing to remaining columns.");

Review Comment:
   Would be good to include `allColumns` in the message so dev knows which are 
untested



##########
core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java:
##########
@@ -170,46 +202,83 @@ public void testAllColumns() {
     mutation.put(ExternalCompactionColumnFamily.STR_NAME, ecid.canonical(), 
ecMeta.toJson());
 
     TServerInstance tsi = new TServerInstance("localhost:9997", 5000L);
+
     MIGRATION_COLUMN.put(mutation, new Value(tsi.getHostPortSession()));
 
     SortedMap<Key,Value> rowMap = toRowMap(mutation);
 
     TabletMetadata tm = TabletMetadata.convertRow(rowMap.entrySet().iterator(),
         EnumSet.allOf(ColumnType.class), true, false);
 
+    assertTrue(tm.getCompacted().isEmpty());
+    allColumns.remove(COMPACTED);
+    
assertEquals(TabletMergeabilityMetadata.fromValue(mergeabilityValue).toJson(),
+        
TabletMergeabilityMetadata.toValue(tm.getTabletMergeability()).toString());
+    allColumns.remove(MERGEABILITY);
+    assertEquals(TabletAvailability.ONDEMAND, tm.getTabletAvailability());
+    allColumns.remove(AVAILABILITY);
+    assertEquals(selectedPath.toString(),
+        tm.getSelectedFiles().getFiles().iterator().next().getMetadataPath());
+    allColumns.remove(SELECTED);

Review Comment:
   Would be good to also assert that there's only one file



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

Reply via email to