Skip to content

Commit

Permalink
Fixing test
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Peinlich <[email protected]>
  • Loading branch information
gezero committed Mar 18, 2022
1 parent d5925bd commit bbe59bf
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.jetbrains.annotations.NotNull;
Expand All @@ -70,7 +69,6 @@ public class BackwardSyncPhaseTest {

private MutableBlockchain remoteBlockchain;
private RespondingEthPeer peer;

GenericKeyValueStorageFacade<Hash, BlockHeader> headersStorage;
GenericKeyValueStorageFacade<Hash, Block> blocksStorage;

Expand Down Expand Up @@ -117,14 +115,10 @@ public void setup() {
public void shouldWaitWhenTTDNotReached()
throws ExecutionException, InterruptedException, TimeoutException {
final BackwardChain backwardChain = createBackwardChain(LOCAL_HEIGHT + 3);
when(context.isOnTTD()).thenReturn(false);
when(context.isOnTTD()).thenReturn(false).thenReturn(false).thenReturn(true);
BackwardSyncPhase step = new BackwardSyncPhase(context, backwardChain);
final CompletableFuture<Void> completableFuture = step.waitForTTD();
assertThat(completableFuture.isDone()).isFalse();
when(context.isOnTTD()).thenReturn(true);

completableFuture.get(6, TimeUnit.SECONDS);
assertThat(completableFuture.isDone()).isFalse();
step.waitForTTD();
verify(context, Mockito.times(2)).getEthContext();
}

@Test
Expand Down

0 comments on commit bbe59bf

Please sign in to comment.