Search in sources :

Example 1 with StorageConfiguration

use of tech.pegasys.teku.services.chainstorage.StorageConfiguration in project teku by ConsenSys.

the class DataOptionsTest method dataPath_shouldReadFromConfigurationFile.

@Test
public void dataPath_shouldReadFromConfigurationFile() {
    final TekuConfiguration tekuConfiguration = getTekuConfigurationFromFile("dataOptions_config.yaml");
    final StorageConfiguration config = tekuConfiguration.storageConfiguration();
    assertThat(tekuConfiguration.dataConfig().getDataBasePath()).isEqualTo(TEST_PATH);
    assertThat(config.getDataStorageMode()).isEqualTo(ARCHIVE);
    assertThat(config.getDataStorageCreateDbVersion()).isEqualTo(DatabaseVersion.V4);
    assertThat(config.getDataStorageFrequency()).isEqualTo(128L);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) StorageConfiguration(tech.pegasys.teku.services.chainstorage.StorageConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 2 with StorageConfiguration

use of tech.pegasys.teku.services.chainstorage.StorageConfiguration in project teku by ConsenSys.

the class DataOptionsTest method dataStorageCreateDbVersion_shouldAcceptNonDefaultValues.

@Test
public void dataStorageCreateDbVersion_shouldAcceptNonDefaultValues() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--Xdata-storage-create-db-version", "noop");
    final StorageConfiguration config = tekuConfiguration.storageConfiguration();
    assertThat(config.getDataStorageCreateDbVersion()).isEqualTo(DatabaseVersion.NOOP);
    assertThat(createConfigBuilder().storageConfiguration(b -> b.dataStorageCreateDbVersion(DatabaseVersion.NOOP)).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) StorageConfiguration(tech.pegasys.teku.services.chainstorage.StorageConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 3 with StorageConfiguration

use of tech.pegasys.teku.services.chainstorage.StorageConfiguration in project teku by ConsenSys.

the class DataOptionsTest method dataStorageCreateDbVersion_shouldDefault.

@Test
public void dataStorageCreateDbVersion_shouldDefault() {
    final StorageConfiguration config = getTekuConfigurationFromArguments().storageConfiguration();
    final DatabaseVersion expectedDefault = DatabaseVersion.isLevelDbSupported() ? DatabaseVersion.LEVELDB_TREE : DatabaseVersion.V5;
    assertThat(config.getDataStorageCreateDbVersion()).isEqualTo(expectedDefault);
}
Also used : StorageConfiguration(tech.pegasys.teku.services.chainstorage.StorageConfiguration) DatabaseVersion(tech.pegasys.teku.storage.server.DatabaseVersion) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 4 with StorageConfiguration

use of tech.pegasys.teku.services.chainstorage.StorageConfiguration in project teku by ConsenSys.

the class DataOptionsTest method dataStorageFrequency_shouldAcceptNonDefaultValues.

@Test
public void dataStorageFrequency_shouldAcceptNonDefaultValues() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--data-storage-archive-frequency", "1024000");
    final StorageConfiguration config = tekuConfiguration.storageConfiguration();
    assertThat(config.getDataStorageFrequency()).isEqualTo(1024000L);
    assertThat(createConfigBuilder().storageConfiguration(b -> b.dataStorageFrequency(1024000L)).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) StorageConfiguration(tech.pegasys.teku.services.chainstorage.StorageConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 5 with StorageConfiguration

use of tech.pegasys.teku.services.chainstorage.StorageConfiguration in project teku by ConsenSys.

the class DataOptionsTest method dataStorageMode_shouldAcceptPrune.

@Test
public void dataStorageMode_shouldAcceptPrune() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--data-storage-mode", "prune");
    final StorageConfiguration config = tekuConfiguration.storageConfiguration();
    assertThat(config.getDataStorageMode()).isEqualTo(PRUNE);
    assertThat(createConfigBuilder().storageConfiguration(b -> b.dataStorageMode(PRUNE)).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) StorageConfiguration(tech.pegasys.teku.services.chainstorage.StorageConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Aggregations

Test (org.junit.jupiter.api.Test)7 AbstractBeaconNodeCommandTest (tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)7 StorageConfiguration (tech.pegasys.teku.services.chainstorage.StorageConfiguration)7 TekuConfiguration (tech.pegasys.teku.config.TekuConfiguration)5 DatabaseVersion (tech.pegasys.teku.storage.server.DatabaseVersion)1