@VisibleForTesting
    static CompletedCheckpointStore createCompletedCheckpointStore(
            Configuration jobManagerConfig,
            CheckpointRecoveryFactory recoveryFactory,
            Executor ioExecutor,
            Logger log,
            JobID jobId,
            RestoreMode restoreMode)
            throws Exception {
        return recoveryFactory.createRecoveredCompletedCheckpointStore(
                jobId,
                DefaultCompletedCheckpointStoreUtils.getMaximumNumberOfRetainedCheckpoints(
                        jobManagerConfig, log),
                SharedStateRegistry.DEFAULT_FACTORY,
                ioExecutor,
                restoreMode);
    }
@Test
    void testSettingMaxNumberOfCheckpointsToRetain() throws Exception {

        final int maxNumberOfCheckpointsToRetain = 10;
        final Configuration jobManagerConfig = new Configuration();
        jobManagerConfig.set(
                CheckpointingOptions.MAX_RETAINED_CHECKPOINTS, maxNumberOfCheckpointsToRetain);

        final CompletedCheckpointStore completedCheckpointStore =
                SchedulerUtils.createCompletedCheckpointStore(
                        jobManagerConfig,
                        new StandaloneCheckpointRecoveryFactory(),
                        Executors.directExecutor(),
                        log,
                        new JobID(),
                        RestoreMode.CLAIM);

        assertThat(completedCheckpointStore.getMaxNumberOfRetainedCheckpoints())
                .isEqualTo(maxNumberOfCheckpointsToRetain);
    }