deniskuzZ commented on code in PR #10661:
URL: https://github.com/apache/iceberg/pull/10661#discussion_r1672697126
##########
mr/src/test/java/org/apache/iceberg/mr/TestIcebergInputFormats.java:
##########
@@ -381,6 +386,46 @@ public void testCustomCatalog() throws IOException {
testInputFormat.create(builder.conf()).validate(expectedRecords);
}
+ @TestTemplate
+ public void testWorkerPool() throws Exception {
+ // 1.The ugi in the same thread will not change
+ final ExecutorService workerPool1 =
ThreadPools.newWorkerPool("iceberg-plan-worker-pool", 1);
+ UserGroupInformation user1 =
+ UserGroupInformation.createUserForTesting("user1", new String[] {});
+ UserGroupInformation user2 =
+ UserGroupInformation.createUserForTesting("user2", new String[] {});
+ assertThat(setAndGetUgi(user1, workerPool1)).isEqualTo("user1");
+ assertThat(setAndGetUgi(user2, workerPool1)).isEqualTo("user1");
+ workerPool1.shutdown();
+
+ // 2.The ugi in different threads will be different
+ final ExecutorService workerPool2 =
ThreadPools.newWorkerPool("iceberg-plan-worker-pool", 1);
+ assertThat(setAndGetUgi(user2, workerPool2)).isEqualTo("user2");
+ workerPool2.shutdown();
+ }
+
+ private String setAndGetUgi(UserGroupInformation ugi, ExecutorService
workpool)
Review Comment:
i don't see any benefit in such a test, it doesn't test the production code.
can't we make a method package private or change accessor and then use argument
captor for the scan and validate that provided pool was set?
--
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]