Search in sources :

Example 1 with SysRepository

use of io.crate.operation.reference.sys.repositories.SysRepository in project crate by crate.

the class SysSnapshotsTest method testErrorsOnRetrievingSnapshotsAreIgnored.

@Test
public void testErrorsOnRetrievingSnapshotsAreIgnored() throws Exception {
    SysRepositoriesService sysRepos = mock(SysRepositoriesService.class);
    Iterable<?> objects = Collections.singletonList((Object) new SysRepository("foo", "url", ImmutableMap.of()));
    when(sysRepos.repositoriesGetter()).then(invocation -> objects);
    SnapshotsService snapshotService = mock(SnapshotsService.class);
    when(snapshotService.snapshots(anyString(), anyBoolean())).thenThrow(new IllegalStateException("dummy"));
    SysSnapshots sysSnapshots = new SysSnapshots(sysRepos, snapshotService);
    assertThat(sysSnapshots.snapshotsGetter().iterator().hasNext(), is(false));
}
Also used : SysRepository(io.crate.operation.reference.sys.repositories.SysRepository) SnapshotsService(org.elasticsearch.snapshots.SnapshotsService) SysRepositoriesService(io.crate.operation.reference.sys.repositories.SysRepositoriesService) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

SysRepositoriesService (io.crate.operation.reference.sys.repositories.SysRepositoriesService)1 SysRepository (io.crate.operation.reference.sys.repositories.SysRepository)1 CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 SnapshotsService (org.elasticsearch.snapshots.SnapshotsService)1 Test (org.junit.Test)1