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


##########
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:
   Hm. Have sense. I looked deeper into code. When we do have pipelines 
created, we choose one of them randomly. When the numbers of pipeline is 0 (our 
case) we create the first pipeline but data nodes for the new pipeline are not 
chosen randomly. 
   This means, we do not have a problem with this test. Anyway, maybe it would 
be a good idea to update the test to take care about it. 



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