slfan1989 commented on code in PR #14243:
URL: https://github.com/apache/iceberg/pull/14243#discussion_r2444805888


##########
flink/v2.1/flink/src/test/java/org/apache/iceberg/flink/maintenance/api/TestZkLockFactory.java:
##########
@@ -51,4 +62,37 @@ public void after() throws IOException {
       zkTestServer.close();
     }
   }
+
+  @Test
+  void testRetryPolicyClassMapping() {
+    for (ZKRetryPolicies policy : ZKRetryPolicies.values()) {
+      ZkLockFactory factory =
+          new ZkLockFactory("localhost:2181", "test", 3000, 3000, 1000, 3, 
2000, policy.name());
+
+      Object retryPolicy = factory.createRetryPolicy();
+      assertThat(retryPolicy).isNotNull();
+
+      String className = retryPolicy.getClass().getSimpleName();
+
+      switch (policy) {
+        case ONE_TIME:
+          assertThat(className).isEqualTo("RetryOneTime");
+          break;
+        case N_TIME:
+          assertThat(className).isEqualTo("RetryNTimes");
+          break;
+        case BOUNDED_EXPONENTIAL_BACKOFF:
+          assertThat(className).isEqualTo("BoundedExponentialBackoffRetry");
+          break;
+        case UNTIL_ELAPSED:
+          assertThat(className).isEqualTo("RetryUntilElapsed");
+          break;
+        case EXPONENTIAL_BACKOFF:
+          assertThat(className).isEqualTo("ExponentialBackoffRetry");
+          break;
+        default:
+          throw new IllegalStateException("Unhandled policy type: " + policy);

Review Comment:
   Yes, if the policy name is invalid, we’ll use ExponentialBackoffRetry as the 
default.



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