djordje-mijatovic commented on code in PR #4209:
URL: https://github.com/apache/ozone/pull/4209#discussion_r1097643978


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestContainerOperations.java:
##########
@@ -132,4 +132,30 @@ public void testDatanodeUsageInfoCompatibility() throws 
IOException {
           .anyMatch(port -> REPLICATION.name().equals(port.getName())));
     }
   }
+
+  @Test
+  public void testDatanodeUsageInfoContainerCount() throws IOException {
+    DatanodeDetails dn = cluster.getStorageContainerManager()
+            .getScmNodeManager()
+            .getAllNodes()
+            .get(0);
+    dn.setCurrentVersion(0);
+
+    List<HddsProtos.DatanodeUsageInfoProto> usageInfoList =
+            storageClient.getDatanodeUsageInfo(
+                    dn.getIpAddress(), dn.getUuidString());
+
+    assertEquals(1, usageInfoList.size());
+    assertEquals(0, usageInfoList.get(0).getContainerCount());
+
+    storageClient.createContainer(HddsProtos
+            .ReplicationType.STAND_ALONE, HddsProtos.ReplicationFactor
+            .ONE, OzoneConsts.OZONE);
+
+    usageInfoList = storageClient.getDatanodeUsageInfo(
+                    dn.getIpAddress(), dn.getUuidString());
+
+    assertEquals(1, usageInfoList.size());
+    assertEquals(1, usageInfoList.get(0).getContainerCount());
+  }

Review Comment:
   In this particular test it is safe as we have only one datanode. Check the 
line 158.



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