Skip to content
Open
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 solana/indexer/common/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func TestFetchTransactionWithCache_CacheMiss(t *testing.T) {
expected := &rpc.GetTransactionResult{}
fakeRpc := &fake_rpc_client.FakeRpcClient{
GetTransactionFunc: func(ctx context.Context, signature solana.Signature, opts *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error) {
if assert.NotNil(t, opts) {
assert.Equal(t, rpc.CommitmentConfirmed, opts.Commitment)
assert.NotNil(t, opts.MaxSupportedTransactionVersion)
assert.Equal(t, rpc.MaxSupportedTransactionVersion1, *opts.MaxSupportedTransactionVersion)
}
return expected, nil
},
}
Expand Down
12 changes: 12 additions & 0 deletions solana/indexer/program/backfiller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,17 @@ func TestBackfillFresh(t *testing.T) {
mockTransactionResponses, err := fake_rpc_client.ZipTransactionResultsAndTransactions(mockTransactionResponses, mockTransactions)
require.NoError(t, err, "failed to zip transaction results and transactions")
rpcFake := fake_rpc_client.NewWithTransactions(mockTransactionResponses)
getBlockWithOpts := rpcFake.GetBlockWithOptsFunc
getBlockCalls := 0
rpcFake.GetBlockWithOptsFunc = func(ctx context.Context, slot uint64, opts *rpc.GetBlockOpts) (*rpc.GetBlockResult, error) {
getBlockCalls++
if assert.NotNil(t, opts) {
assert.Equal(t, rpc.CommitmentConfirmed, opts.Commitment)
assert.NotNil(t, opts.MaxSupportedTransactionVersion)
assert.Equal(t, rpc.MaxSupportedTransactionVersion1, *opts.MaxSupportedTransactionVersion)
}
return getBlockWithOpts(ctx, slot, opts)
}

poolMock, err := pgxmock.NewPool()
require.NoError(t, err, "failed to create mock database pool")
Expand Down Expand Up @@ -395,6 +406,7 @@ func TestBackfillFresh(t *testing.T) {
err = s.Start(context.Background(), 100, 200)

assert.NoError(t, err)
assert.Equal(t, 2, getBlockCalls)
assert.NoError(t, poolMock.ExpectationsWereMet())
processorMock.AssertExpectations(t)
}
Loading