mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-08 20:47:59 -05:00
services - migrate to junit 5 (#5613)
* services to junit5 * removed some junit4 engine imports * updated some plugins test since these extend from testutil KV storage * one more form of EPL v2 Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com> --------- Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
This commit is contained in:
@@ -55,6 +55,7 @@ dependencies {
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
testImplementation 'org.mockito:mockito-core'
|
||||
testImplementation 'org.mockito:mockito-junit-jupiter'
|
||||
|
||||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.tuweni.bytes.Bytes;
|
||||
|
||||
public class OptimisticTransactionDBRocksDBColumnarKeyValueStorageTest
|
||||
extends RocksDBColumnarKeyValueStorageTest {
|
||||
|
||||
@@ -32,7 +34,9 @@ public class OptimisticTransactionDBRocksDBColumnarKeyValueStorageTest
|
||||
protected SegmentedKeyValueStorage<RocksDbSegmentIdentifier> createSegmentedStore()
|
||||
throws Exception {
|
||||
return new OptimisticRocksDBColumnarKeyValueStorage(
|
||||
new RocksDBConfigurationBuilder().databaseDir(folder.newFolder().toPath()).build(),
|
||||
new RocksDBConfigurationBuilder()
|
||||
.databaseDir(folder.resolve(Bytes.random(9).toString()))
|
||||
.build(),
|
||||
Arrays.asList(TestSegment.FOO, TestSegment.BAR),
|
||||
List.of(),
|
||||
new NoOpMetricsSystem(),
|
||||
|
||||
@@ -35,13 +35,12 @@ import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
public abstract class RocksDBColumnarKeyValueStorageTest extends AbstractKeyValueStorageTest {
|
||||
|
||||
@Rule public final TemporaryFolder folder = new TemporaryFolder();
|
||||
@TempDir public Path folder;
|
||||
|
||||
@Test
|
||||
public void assertClear() throws Exception {
|
||||
@@ -178,8 +177,8 @@ public abstract class RocksDBColumnarKeyValueStorageTest extends AbstractKeyValu
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dbShouldIgnoreExperimentalSegmentsIfNotExisted() throws Exception {
|
||||
final Path testPath = folder.newFolder().toPath();
|
||||
public void dbShouldIgnoreExperimentalSegmentsIfNotExisted(@TempDir final Path testPath)
|
||||
throws Exception {
|
||||
// Create new db should ignore experimental column family
|
||||
SegmentedKeyValueStorage<RocksDbSegmentIdentifier> store =
|
||||
createSegmentedStore(
|
||||
@@ -195,8 +194,8 @@ public abstract class RocksDBColumnarKeyValueStorageTest extends AbstractKeyValu
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dbShouldNotIgnoreExperimentalSegmentsIfExisted() throws Exception {
|
||||
final Path testPath = folder.newFolder().toPath();
|
||||
public void dbShouldNotIgnoreExperimentalSegmentsIfExisted(@TempDir final Path testPath)
|
||||
throws Exception {
|
||||
// Create new db with experimental column family
|
||||
SegmentedKeyValueStorage<RocksDbSegmentIdentifier> store =
|
||||
createSegmentedStore(
|
||||
@@ -225,8 +224,8 @@ public abstract class RocksDBColumnarKeyValueStorageTest extends AbstractKeyValu
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dbWillBeBackwardIncompatibleAfterExperimentalSegmentsAreAdded() throws Exception {
|
||||
final Path testPath = folder.newFolder().toPath();
|
||||
public void dbWillBeBackwardIncompatibleAfterExperimentalSegmentsAreAdded(
|
||||
@TempDir final Path testPath) throws Exception {
|
||||
// Create new db should ignore experimental column family
|
||||
SegmentedKeyValueStorage<RocksDbSegmentIdentifier> store =
|
||||
createSegmentedStore(
|
||||
|
||||
@@ -35,24 +35,24 @@ import org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksD
|
||||
import org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBConfigurationBuilder;
|
||||
import org.hyperledger.besu.plugin.services.storage.rocksdb.unsegmented.RocksDBKeyValueStorage;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class RocksDBKeyValueStorageTest extends AbstractKeyValueStorageTest {
|
||||
|
||||
@Mock private ObservableMetricsSystem metricsSystemMock;
|
||||
@Mock private LabelledMetric<OperationTimer> labelledMetricOperationTimerMock;
|
||||
@Mock private LabelledMetric<Counter> labelledMetricCounterMock;
|
||||
@Mock private OperationTimer operationTimerMock;
|
||||
@Rule public final TemporaryFolder folder = new TemporaryFolder();
|
||||
@TempDir static Path folder;
|
||||
|
||||
@Override
|
||||
protected KeyValueStorage createStore() throws Exception {
|
||||
@@ -131,6 +131,6 @@ public class RocksDBKeyValueStorageTest extends AbstractKeyValueStorageTest {
|
||||
}
|
||||
|
||||
private RocksDBConfiguration config() throws Exception {
|
||||
return new RocksDBConfigurationBuilder().databaseDir(folder.newFolder().toPath()).build();
|
||||
return new RocksDBConfigurationBuilder().databaseDir(getTempSubFolder(folder)).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TransactionDBRocksDBColumnarKeyValueStorageTest
|
||||
protected SegmentedKeyValueStorage<RocksDbSegmentIdentifier> createSegmentedStore()
|
||||
throws Exception {
|
||||
return new TransactionDBRocksDBColumnarKeyValueStorage(
|
||||
new RocksDBConfigurationBuilder().databaseDir(folder.newFolder().toPath()).build(),
|
||||
new RocksDBConfigurationBuilder().databaseDir(getTempSubFolder(folder)).build(),
|
||||
Arrays.asList(TestSegment.FOO, TestSegment.BAR),
|
||||
List.of(),
|
||||
new NoOpMetricsSystem(),
|
||||
|
||||
Reference in New Issue
Block a user