@Override
    public void doRun() {
        doRun(false);
    }
@Test
    void noConcurrentPollingForFieldTypes() throws InterruptedException {
        final IndexSetConfig indexSet = IndexSetConfig.builder()
                .id("indexSet1")
                .title("Test Index Set")
                .indexPrefix("test")
                .shards(2)
                .creationDate(ZonedDateTime.now())
                .indexAnalyzer("standard")
                .indexTemplateName("test")
                .indexOptimizationMaxNumSegments(2048)
                .indexOptimizationDisabled(false)
                .fieldTypeRefreshInterval(org.joda.time.Duration.standardSeconds(1))
                .retentionStrategyConfig(NoopRetentionStrategyConfig.createDefault())
                .rotationStrategyConfig(MessageCountRotationStrategyConfig.createDefault())
                .replicas(1)
                .build();
        final List<IndexSetConfig> indexSets = List.of(indexSet);
        when(indexSetService.findAll()).thenReturn(indexSets);

        final MongoIndexSet mongoIndexSet = mock(MongoIndexSet.class);
        when(mongoIndexSet.getActiveWriteIndex()).thenReturn("test_0");
        when(mongoIndexSetFactory.create(eq(indexSet))).thenReturn(mongoIndexSet);

        final CountDownLatch start = new CountDownLatch(1);
        final CountDownLatch done = new CountDownLatch(1);
        when(indexFieldTypePoller.pollIndex(anyString(), anyString()))
                .thenAnswer((Answer<Optional<IndexFieldTypesDTO>>) invocationOnMock -> {
                    start.countDown();
                    done.await();
                    return Optional.empty();
                });

        periodical.doRun();

        // Wait until first job is waiting for index field type poller
        start.await();

        // Then start second job
        periodical.doRun();

        // Waiting for second job to complete
        await().atMost(1, TimeUnit.MINUTES).until(() -> scheduler.getCompletedTaskCount() == 1);

        // And release first job
        done.countDown();

        await().atMost(1, TimeUnit.MINUTES).until(() -> scheduler.getCompletedTaskCount() == 2);

        verify(indexFieldTypePoller, times(1)).pollIndex(anyString(), anyString());
    }