azagrebin commented on a change in pull request #7526: [FLINK-11353][tests] 
Port JobManagerHAJobGraphRecoveryITCase to new code base
URL: https://github.com/apache/flink/pull/7526#discussion_r249105887
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/DispatcherHATest.java
 ##########
 @@ -225,13 +243,78 @@ public static JobGraph createNonEmptyJobGraph() {
                return jobGraph;
        }
 
-       private static class HATestingDispatcher extends TestingDispatcher {
+       @Test
+       public void testPersistedJobGraphWhenDispatcherIsShutDown() throws 
Exception {
+               final JobGraph jobGraph = createNonEmptyJobGraph();
+               final TestingHighAvailabilityServices highAvailabilityServices 
= new TestingHighAvailabilityServices();
 
-               @Nonnull
-               private final BlockingQueue<DispatcherId> fencingTokens;
+               final InMemorySubmittedJobGraphStore submittedJobGraphStore = 
new InMemorySubmittedJobGraphStore();
+               
highAvailabilityServices.setSubmittedJobGraphStore(submittedJobGraphStore);
+
+               final TestingLeaderElectionService leaderElectionService = new 
TestingLeaderElectionService();
+               
highAvailabilityServices.setDispatcherLeaderElectionService(leaderElectionService);
+
+               
highAvailabilityServices.setJobMasterLeaderElectionService(jobGraph.getJobID(), 
new TestingLeaderElectionService());
+               highAvailabilityServices.setResourceManagerLeaderRetriever(new 
SettableLeaderRetrievalService());
+               highAvailabilityServices.setCheckpointRecoveryFactory(new 
StandaloneCheckpointRecoveryFactory());
 
-               HATestingDispatcher(RpcService rpcService, String endpointId, 
Configuration configuration, HighAvailabilityServices highAvailabilityServices, 
ResourceManagerGateway resourceManagerGateway, BlobServer blobServer, 
HeartbeatServices heartbeatServices, JobManagerMetricGroup 
jobManagerMetricGroup, @Nullable String metricQueryServicePath, 
ArchivedExecutionGraphStore archivedExecutionGraphStore, 
JobManagerRunnerFactory jobManagerRunnerFactory, FatalErrorHandler 
fatalErrorHandler, @Nonnull BlockingQueue<DispatcherId> fencingTokens) throws 
Exception {
-                       super(rpcService, endpointId, configuration, 
highAvailabilityServices, resourceManagerGateway, blobServer, 
heartbeatServices, jobManagerMetricGroup, metricQueryServicePath, 
archivedExecutionGraphStore, jobManagerRunnerFactory, fatalErrorHandler);
+               final HATestingDispatcher dispatcher = createDispatcher(
+                       highAvailabilityServices,
+                       Dispatcher.DefaultJobManagerRunnerFactory.INSTANCE);
+
+               dispatcher.start();
+
+               try {
+                       // grant leadership and submit a single job
+                       final DispatcherId expectedDispatcherId = 
DispatcherId.generate();
+                       
leaderElectionService.isLeader(expectedDispatcherId.toUUID()).get();
+
+                       final DispatcherGateway dispatcherGateway = 
dispatcher.getSelfGateway(DispatcherGateway.class);
+                       final CompletableFuture<Acknowledge> submissionFuture = 
dispatcherGateway.submitJob(jobGraph, timeout);
+                       submissionFuture.get();
+                       assertThat(dispatcher.getNumberJobs(timeout).get(), 
is(1));
+
+                       dispatcher.shutDown();
+                       dispatcher.getTerminationFuture().get();
+
+                       
assertThat(submittedJobGraphStore.contains(jobGraph.getJobID()), is(true));
 
 Review comment:
   Will it be deleted if it is not an HA setup?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to