Skip to content

Commit

Permalink
Event queue test fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Whitehead <[email protected]>
  • Loading branch information
matthew1001 committed Jun 25, 2024
1 parent f313912 commit 7bd09e3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1281,13 +1281,18 @@ public void bonsaiLimitTrieLogsEnabledByDefault() {
}

@Test
public void parsesInvalidDefaultBonsaiLimitTrieLogsWhenFullSyncEnabled() {
public void parsesChangesDefaultBonsaiLimitTrieLogsWhenFullSyncEnabled() {
parseCommand("--sync-mode=FULL");
verify(mockControllerBuilder)
.dataStorageConfiguration(dataStorageConfigurationArgumentCaptor.capture());

final DataStorageConfiguration dataStorageConfiguration =
dataStorageConfigurationArgumentCaptor.getValue();
assertThat(dataStorageConfiguration.getDataStorageFormat()).isEqualTo(BONSAI);
assertThat(dataStorageConfiguration.getBonsaiLimitTrieLogsEnabled()).isFalse();

Mockito.verifyNoInteractions(mockRunnerBuilder);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains("Cannot enable --bonsai-limit-trie-logs-enabled with sync-mode FULL");
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public void handlesQueueInterruptGracefully() throws InterruptedException {
@Test
public void drainEventsIntoStateMachine() throws InterruptedException {
final BftEventQueue queue = new BftEventQueue(1000);
queue.start();
final BftProcessor processor = new BftProcessor(queue, mockeEventMultiplexer);

// Start the BftProcessor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class RoundTimerTest {
public void initialise() {
bftExecutors = mock(BftExecutors.class);
queue = new BftEventQueue(1000);
queue.start();
timer = new RoundTimer(queue, 1, bftExecutors);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class BftMiningCoordinatorTest {

@BeforeEach
public void setup() {
eventQueue.start();
bftMiningCoordinator =
new BftMiningCoordinator(
bftExecutors, controller, bftProcessor, bftBlockCreatorFactory, blockChain, eventQueue);
Expand Down

0 comments on commit 7bd09e3

Please sign in to comment.