@Override
    public CompletableFuture<String> triggerSavepoint(
            @Nullable final String targetDirectory,
            final boolean cancelJob,
            final SavepointFormatType formatType,
            final Time timeout) {

        return schedulerNG.triggerSavepoint(targetDirectory, cancelJob, formatType);
    }
@Test
    void testTriggerSavepointTimeout() throws Exception {
        final TestingSchedulerNG testingSchedulerNG =
                TestingSchedulerNG.newBuilder()
                        .setTriggerSavepointFunction(
                                (ignoredA, ignoredB, formatType) -> new CompletableFuture<>())
                        .build();

        try (final JobMaster jobMaster =
                new JobMasterBuilder(jobGraph, rpcService)
                        .withFatalErrorHandler(testingFatalErrorHandler)
                        .withSlotPoolServiceSchedulerFactory(
                                DefaultSlotPoolServiceSchedulerFactory.create(
                                        TestingSlotPoolServiceBuilder.newBuilder(),
                                        new TestingSchedulerNGFactory(testingSchedulerNG)))
                        .createJobMaster()) {

            jobMaster.start();

            final JobMasterGateway jobMasterGateway =
                    jobMaster.getSelfGateway(JobMasterGateway.class);
            final CompletableFuture<String> savepointFutureLowTimeout =
                    jobMasterGateway.triggerSavepoint(
                            "/tmp", false, SavepointFormatType.CANONICAL, Time.milliseconds(1));
            final CompletableFuture<String> savepointFutureHighTimeout =
                    jobMasterGateway.triggerSavepoint(
                            "/tmp", false, SavepointFormatType.CANONICAL, RpcUtils.INF_TIMEOUT);

            assertThatThrownBy(
                            () ->
                                    savepointFutureLowTimeout.get(
                                            testingTimeout.getSize(), testingTimeout.getUnit()))
                    .hasRootCauseInstanceOf(TimeoutException.class);

            assertThat(savepointFutureHighTimeout).isNotDone();
        }
    }