Search in sources :

Example 1 with FsProbe

use of org.elasticsearch.monitor.fs.FsProbe in project crate by crate.

the class SysNodeChecksTest method testGetLeastAvailablePathForDiskWatermarkChecks.

@Test
public void testGetLeastAvailablePathForDiskWatermarkChecks() throws IOException {
    FsProbe fsProbe = mock(FsProbe.class);
    FsInfo fsInfo = mock(FsInfo.class);
    when(fsProbe.stats()).thenReturn(fsInfo);
    when(fsInfo.iterator()).thenReturn(ImmutableList.of(new FsInfo.Path("/middle", "/dev/sda", 300, 170, 160), new FsInfo.Path("/most", "/dev/sdc", 300, 150, 140)).iterator());
    DiskWatermarkNodesSysCheck diskWatermark = new LowDiskWatermarkNodesSysCheck(clusterService, mock(Provider.class), fsProbe);
    assertThat(diskWatermark.getLeastAvailablePath().getAvailable().getBytes(), is(140L));
}
Also used : FsInfo(org.elasticsearch.monitor.fs.FsInfo) FsProbe(org.elasticsearch.monitor.fs.FsProbe) Provider(org.elasticsearch.common.inject.Provider) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 Provider (org.elasticsearch.common.inject.Provider)1 FsInfo (org.elasticsearch.monitor.fs.FsInfo)1 FsProbe (org.elasticsearch.monitor.fs.FsProbe)1 Test (org.junit.Test)1