1u0 commented on a change in pull request #8741: [FLINK-12752] Add Option to 
Pass Seed for JobID Hash for StandaloneJobClusterEntrypoint
URL: https://github.com/apache/flink/pull/8741#discussion_r297555970
 
 

 ##########
 File path: 
flink-container/src/test/java/org/apache/flink/container/entrypoint/StandaloneJobClusterEntryPointTest.java
 ##########
 @@ -67,54 +65,109 @@ public void testDontOverwriteExecutionMode() {
        }
 
        @Test
-       public void configuredJobIDTakesPrecedenceWithHA() {
-               Optional<JobID> jobID = Optional.of(JobID.generate());
+       public void configuredJobIdTakesPrecedenceWithHA() {
+               JobID jobId = JobID.generate();
+               String jobIdSeed = null;
+
+               Configuration globalConfiguration = new Configuration();
+               enableHighAvailability(globalConfiguration);
+
+               JobID jobIdForCluster = 
StandaloneJobClusterEntryPoint.resolveJobIdForCluster(
+                       jobId,
+                       jobIdSeed,
+                       globalConfiguration);
+
+               assertThat(jobIdForCluster, is(jobId));
+       }
+
+       @Test
+       public void configuredJobIdTakesPrecedenceWithoutHA() {
+               JobID jobId = JobID.generate();
+               String jobIdSeed = null;
+
+               Configuration globalConfiguration = new Configuration();
+
+               JobID jobIdForCluster = 
StandaloneJobClusterEntryPoint.resolveJobIdForCluster(
+                       jobId,
+                       jobIdSeed,
+                       globalConfiguration);
+
+               assertThat(jobIdForCluster, is(jobId));
+       }
+
+       @Test
+       public void configuredJobIdSeedTakesPrecedenceWithoutHA() {
+               JobID jobId = null;
+               String jobIdSeed = "some-seed";
+
+               Configuration globalConfiguration = new Configuration();
+
+               JobID jobIdForCluster = 
StandaloneJobClusterEntryPoint.resolveJobIdForCluster(
+                       jobId,
+                       jobIdSeed,
+                       globalConfiguration);
+
+               assertThat(jobIdForCluster, is(JobID.fromSeed(jobIdSeed)));
+       }
+
+       @Test
+       public void configuredJobIdSeedTakesPrecedenceWithHA() {
+               JobID jobId = null;
+               String jobIdSeed = "some-seed";
 
                Configuration globalConfiguration = new Configuration();
                enableHighAvailability(globalConfiguration);
 
                JobID jobIdForCluster = 
StandaloneJobClusterEntryPoint.resolveJobIdForCluster(
-                       jobID,
+                       jobId,
+                       jobIdSeed,
                        globalConfiguration);
 
-               assertThat(jobIdForCluster, is(jobID.get()));
+               assertThat(jobIdForCluster, is(JobID.fromSeed(jobIdSeed)));
        }
 
        @Test
-       public void configuredJobIDTakesPrecedenceWithoutHA() {
-               Optional<JobID> jobID = Optional.of(JobID.generate());
+       public void configuredJobIdTakesPrecedenceOverJobIdSeed() {
+               JobID jobId = JobID.generate();
+               String jobIdSeed = "some-seed";
 
                Configuration globalConfiguration = new Configuration();
+               enableHighAvailability(globalConfiguration);
 
                JobID jobIdForCluster = 
StandaloneJobClusterEntryPoint.resolveJobIdForCluster(
-                       jobID,
+                       jobId,
+                       jobIdSeed,
                        globalConfiguration);
 
-               assertThat(jobIdForCluster, is(jobID.get()));
+               assertThat(jobIdForCluster, is(jobId));
        }
 
        @Test
-       public void jobIDdefaultsToZeroWithHA() {
-               Optional<JobID> jobID = Optional.empty();
+       public void jobIdDefaultsToZeroWithHA() {
+               JobID jobId = null;
+               String jobIdSeed = null;
 
                Configuration globalConfiguration = new Configuration();
                enableHighAvailability(globalConfiguration);
 
                JobID jobIdForCluster = 
StandaloneJobClusterEntryPoint.resolveJobIdForCluster(
-                       jobID,
+                       jobId,
+                       jobIdSeed,
                        globalConfiguration);
 
                assertThat(jobIdForCluster, is(ZERO_JOB_ID));
        }
 
        @Test
-       public void jobIDdefaultsToRandomJobIDWithoutHA() {
-               Optional<JobID> jobID = Optional.empty();
+       public void jobIdDefaultsToRandomJobIDWithoutHA() {
 
 Review comment:
   Rename `jobIdDefaultsToRandomJobIDWithoutHA` to 
`jobIdDefaultsToRandomJobIdWithoutHA`, to finish getting rid of `ID` in the 
method/variables names in this file?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to