Skip to content

Commit

Permalink
fix TestBSBProducerCallerCancelsCtx
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Oct 31, 2024
1 parent fab9c7a commit 096e677
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ingest/cdp/producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/support/compressxdr"
"github.com/stellar/go/support/datastore"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)

func TestDefaultBSBConfigs(t *testing.T) {
Expand Down Expand Up @@ -208,16 +209,14 @@ func TestBSBProducerCallerCancelsCtx(t *testing.T) {
})

mockDataStore.On("GetFile", mock.Anything, "FFFFFFFD--2.xdr.zstd").
Run(func(args mock.Arguments) {
cancel()
}).
Return(makeSingleLCMBatch(2), nil)
// this second attempt needs to be mocked, ledger buffer queues this 'next' sequence task automatically
// in getFromLedgerQueue after it receives "FFFFFFFD--2.xdr.zstd", the ctx is not checked then or in
// the async worker routine that receives the task.
mockDataStore.On("GetFile", mock.Anything, "FFFFFFFC--3.xdr.zstd").Return(makeSingleLCMBatch(3), nil)

appCallback := func(lcm xdr.LedgerCloseMeta) error {
cancel()
return nil
}

Expand Down

0 comments on commit 096e677

Please sign in to comment.