Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions catchup/fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ func (p *testUnicastPeer) RoutingAddr() []byte {
}

func (p *testUnicastPeer) Request(ctx context.Context, tag protocol.Tag, topics network.Topics) (resp *network.Response, e error) {
select {
case <-ctx.Done():
return resp, ctx.Err()
default:
}

responseChannel := make(chan *network.Response, 1)
p.responseChannels[0] = responseChannel
Expand Down
8 changes: 8 additions & 0 deletions ledger/catchpointfilewriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,11 @@ func TestFullCatchpointWriter(t *testing.T) {
// another approach is to modify the test and craft round numbers,
// and make the ledger to generate catchpoint itself when it is time
func testCatchpointFlushRound(l *Ledger) (basics.Round, basics.Round) {
// Ensure all blocks are persisted to the block DB before flushing trackers.
// Without this, LatestCommitted() may return a stale round if the blockQueue
// syncer hasn't finished yet.
l.WaitForCommit(l.Latest())

// Clear the timer to ensure a flush
l.trackers.mu.Lock()
l.trackers.lastFlushTime = time.Time{}
Expand Down Expand Up @@ -1036,6 +1041,7 @@ func TestCatchpointAfterTxns(t *testing.T) {
catchpointDataFilePath := filepath.Join(tempDir, t.Name()+".data")
catchpointFilePath := filepath.Join(tempDir, t.Name()+".catchpoint.tar.gz")

testCatchpointFlushRound(dl.validator)
cph := testWriteCatchpoint(t, config.Consensus[proto], dl.validator.trackerDB(), catchpointDataFilePath, catchpointFilePath, 0, 0)
require.EqualValues(t, 3, cph.TotalChunks)

Expand All @@ -1052,6 +1058,7 @@ func TestCatchpointAfterTxns(t *testing.T) {
dl.fullBlock(&newacctpay)

// Write and read back in, and ensure even the last effect exists.
testCatchpointFlushRound(dl.validator)
cph = testWriteCatchpoint(t, config.Consensus[proto], dl.validator.trackerDB(), catchpointDataFilePath, catchpointFilePath, 0, 0)
require.EqualValues(t, cph.TotalChunks, 3) // Still only 3 chunks, as last was in a recent block

Expand All @@ -1068,6 +1075,7 @@ func TestCatchpointAfterTxns(t *testing.T) {
dl.fullBlock(pay.Noted(strconv.Itoa(i)))
}

testCatchpointFlushRound(dl.validator)
cph = testWriteCatchpoint(t, config.Consensus[proto], dl.validator.trackerDB(), catchpointDataFilePath, catchpointFilePath, 0, 0)
require.EqualValues(t, cph.TotalChunks, 4)

Expand Down
1 change: 1 addition & 0 deletions network/wsNetwork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ func setupWebsocketNetworkABwithLogger(t *testing.T, countTarget int, log loggin
readyTimeout := time.NewTimer(5 * time.Second)
waitReady(t, netA, readyTimeout.C)
t.Log("a ready")
readyTimeout.Reset(5 * time.Second)
waitReady(t, netB, readyTimeout.C)
t.Log("b ready")

Expand Down
2 changes: 1 addition & 1 deletion test/e2e-go/cli/goal/expect/catchpointCatchupTest.exp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ if { [catch {
::AlgorandGoal::StartNode $TEST_ROOT_DIR/Node False $WEBPROXY_LISTEN_ADDRESS

# once the node is started we can clear the ::GLOBAL_TEST_ALGO_DIR, so that shutdown would be done as a network.
set ::GLOBAL_TEST_ALGO_DIR ""
unset ::GLOBAL_TEST_ALGO_DIR

::AlgorandGoal::WaitForRound $CATCHPOINT_ROUND $TEST_ROOT_DIR/Node

Expand Down
Loading