errose28 commented on code in PR #6945:
URL: https://github.com/apache/ozone/pull/6945#discussion_r1704655698


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainerWithTLS.java:
##########
@@ -224,6 +228,64 @@ public void downloadContainer(boolean 
containerTokenEnabled)
     }
   }
 
+  @ParameterizedTest(name = "Container token enabled: {0}")
+  @ValueSource(booleans = {false, true})
+  public void testDNContainerOperationClient(boolean containerTokenEnabled)
+      throws Exception {
+    conf.setBoolean(HddsConfigKeys.HDDS_CONTAINER_TOKEN_ENABLED,
+        containerTokenEnabled);
+    OzoneContainer container = createAndStartOzoneContainerInstance();
+    DNContainerOperationClient dnClient =
+        new DNContainerOperationClient(conf, caClient, keyClient);
+    ScmClientConfig scmClientConf = conf.getObject(ScmClientConfig.class);
+    XceiverClientManager clientManager =
+        new XceiverClientManager(conf, scmClientConf, aClientTrustManager());
+    XceiverClientSpi client = null;
+    try {
+      client = clientManager.acquireClient(pipeline);
+      long containerId = createAndCloseContainer(client, 
containerTokenEnabled);
+      ByteString containerMerkleTree =
+          dnClient.getContainerMerkleTree(containerId, dn);
+      // Getting container merkle tree with valid container token
+      assertEquals(containerMerkleTree, ByteString.EMPTY);
+
+      // Getting container merkle tree with invalid container token
+      if (containerTokenEnabled) {
+        assertThrows(IOException.class, () ->
+            getContainerMerkleTree(containerId, dn, "invalidToken", dnClient));
+      } else {
+        containerMerkleTree = getContainerMerkleTree(containerId, dn, 
"invalidToken", dnClient);
+        assertEquals(containerMerkleTree, ByteString.EMPTY);
+      }
+    } finally {
+      if (container != null) {
+        container.stop();
+      }
+      if (client != null) {
+        clientManager.releaseClient(client, true);
+      }
+      if (dnClient != null) {
+        dnClient.close();
+      }
+    }
+  }
+
+  public ByteString getContainerMerkleTree(long containerId,

Review Comment:
   ```suggestion
     private ByteString getContainerMerkleTree(long containerId,
   ```



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