@Override
    public void start() throws Exception {
        LOG.debug("Start leadership runner for job {}.", getJobID());
        leaderElection.startLeaderElection(this);
    }
@Test
    void testJobMasterServiceProcessShutdownOnLeadershipLoss() throws Exception {
        final CompletableFuture<Void> terminationFuture = new CompletableFuture<>();
        final JobManagerRunner jobManagerRunner =
                newJobMasterServiceLeadershipRunnerBuilder()
                        .withSingleJobMasterServiceProcess(
                                TestingJobMasterServiceProcess.newBuilder()
                                        .setCloseAsyncSupplier(
                                                () -> {
                                                    terminationFuture.complete(null);
                                                    return terminationFuture;
                                                })
                                        .build())
                        .build();

        jobManagerRunner.start();

        leaderElection.isLeader(UUID.randomUUID());

        leaderElection.notLeader();

        assertThat(terminationFuture).isDone();
    }