Search in sources :

Example 1 with ErrorThreshold

use of com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold in project dsbulk by datastax.

the class LogSettingsTest method should_disable_maxErrors.

@Test()
void should_disable_maxErrors() throws IOException {
    Config config = TestConfigUtils.createTestConfig("dsbulk.log", "maxErrors", -42);
    LogSettings settings = new LogSettings(config, executionId);
    settings.init();
    ErrorThreshold threshold = settings.errorThreshold;
    assertThat(threshold).isInstanceOf(UnlimitedErrorThreshold.class);
}
Also used : Config(com.typesafe.config.Config) RatioErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.RatioErrorThreshold) ErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold) AbsoluteErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold) UnlimitedErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.UnlimitedErrorThreshold) Test(org.junit.jupiter.api.Test)

Example 2 with ErrorThreshold

use of com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold in project dsbulk by datastax.

the class LogSettingsTest method should_accept_maxQueryWarnings_as_absolute_number.

@Test()
void should_accept_maxQueryWarnings_as_absolute_number() throws IOException {
    Config config = TestConfigUtils.createTestConfig("dsbulk.log", "maxQueryWarnings", 20);
    LogSettings settings = new LogSettings(config, executionId);
    settings.init();
    ErrorThreshold threshold = settings.queryWarningsThreshold;
    assertThat(threshold).isInstanceOf(AbsoluteErrorThreshold.class);
    assertThat(((AbsoluteErrorThreshold) threshold).getMaxErrors()).isEqualTo(20);
}
Also used : AbsoluteErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold) Config(com.typesafe.config.Config) RatioErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.RatioErrorThreshold) ErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold) AbsoluteErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold) UnlimitedErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.UnlimitedErrorThreshold) Test(org.junit.jupiter.api.Test)

Example 3 with ErrorThreshold

use of com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold in project dsbulk by datastax.

the class LogSettingsTest method should_disable_maxQueryWarnings.

@Test()
void should_disable_maxQueryWarnings() throws IOException {
    Config config = TestConfigUtils.createTestConfig("dsbulk.log", "maxQueryWarnings", -42);
    LogSettings settings = new LogSettings(config, executionId);
    settings.init();
    ErrorThreshold threshold = settings.queryWarningsThreshold;
    assertThat(threshold).isInstanceOf(UnlimitedErrorThreshold.class);
}
Also used : Config(com.typesafe.config.Config) RatioErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.RatioErrorThreshold) ErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold) AbsoluteErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold) UnlimitedErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.UnlimitedErrorThreshold) Test(org.junit.jupiter.api.Test)

Example 4 with ErrorThreshold

use of com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold in project dsbulk by datastax.

the class LogSettingsTest method should_accept_maxErrors_as_percentage.

@Test()
void should_accept_maxErrors_as_percentage() throws IOException {
    Config config = TestConfigUtils.createTestConfig("dsbulk.log", "maxErrors", "20%");
    LogSettings settings = new LogSettings(config, executionId);
    settings.init();
    ErrorThreshold threshold = settings.errorThreshold;
    assertThat(threshold).isInstanceOf(RatioErrorThreshold.class);
    assertThat(((RatioErrorThreshold) threshold).getMaxErrorRatio()).isEqualTo(0.2f);
    // min sample is fixed and cannot be changed by the user currently
    assertThat(((RatioErrorThreshold) threshold).getMinSample()).isEqualTo(100);
}
Also used : Config(com.typesafe.config.Config) RatioErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.RatioErrorThreshold) RatioErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.RatioErrorThreshold) ErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold) AbsoluteErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold) UnlimitedErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.UnlimitedErrorThreshold) Test(org.junit.jupiter.api.Test)

Example 5 with ErrorThreshold

use of com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold in project dsbulk by datastax.

the class LogSettingsTest method should_accept_maxErrors_as_absolute_number.

@Test()
void should_accept_maxErrors_as_absolute_number() throws IOException {
    Config config = TestConfigUtils.createTestConfig("dsbulk.log", "maxErrors", 20);
    LogSettings settings = new LogSettings(config, executionId);
    settings.init();
    ErrorThreshold threshold = settings.errorThreshold;
    assertThat(threshold).isInstanceOf(AbsoluteErrorThreshold.class);
    assertThat(((AbsoluteErrorThreshold) threshold).getMaxErrors()).isEqualTo(20);
}
Also used : AbsoluteErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold) Config(com.typesafe.config.Config) RatioErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.RatioErrorThreshold) ErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold) AbsoluteErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold) UnlimitedErrorThreshold(com.datastax.oss.dsbulk.workflow.api.error.UnlimitedErrorThreshold) Test(org.junit.jupiter.api.Test)

Aggregations

AbsoluteErrorThreshold (com.datastax.oss.dsbulk.workflow.api.error.AbsoluteErrorThreshold)5 ErrorThreshold (com.datastax.oss.dsbulk.workflow.api.error.ErrorThreshold)5 RatioErrorThreshold (com.datastax.oss.dsbulk.workflow.api.error.RatioErrorThreshold)5 UnlimitedErrorThreshold (com.datastax.oss.dsbulk.workflow.api.error.UnlimitedErrorThreshold)5 Config (com.typesafe.config.Config)5 Test (org.junit.jupiter.api.Test)5