From 0a2975cf8017874e4a2b113e3685302f9ca63e4e Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 8 Sep 2022 12:32:31 -0700 Subject: [PATCH] Fix test structures (TODO: fix tests themselves) --- exp/lighthorizon/adapters/transaction_test.go | 19 +++++++++++-------- exp/lighthorizon/ingester/mock_ingester.go | 6 ++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/exp/lighthorizon/adapters/transaction_test.go b/exp/lighthorizon/adapters/transaction_test.go index 6699083f6f..5a8ba4ab80 100644 --- a/exp/lighthorizon/adapters/transaction_test.go +++ b/exp/lighthorizon/adapters/transaction_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stellar/go/exp/lighthorizon/common" + "github.com/stellar/go/exp/lighthorizon/ingester" "github.com/stellar/go/ingest" "github.com/stellar/go/network" protocol "github.com/stellar/go/protocols/horizon" @@ -52,15 +53,17 @@ func TestTransactionAdapter(t *testing.T) { closeTimestamp := expectedTx.LedgerCloseTime.UTC().Unix() tx := common.Transaction{ - LedgerTransaction: &ingest.LedgerTransaction{ - Index: 0, - Envelope: txEnv, - Result: xdr.TransactionResultPair{ - TransactionHash: xdr.Hash{}, - Result: txResult, + LedgerTransaction: &ingester.LedgerTransaction{ + LedgerTransaction: &ingest.LedgerTransaction{ + Index: 0, + Envelope: txEnv, + Result: xdr.TransactionResultPair{ + TransactionHash: xdr.Hash{}, + Result: txResult, + }, + FeeChanges: txFeeMeta, + UnsafeMeta: txMeta, }, - FeeChanges: txFeeMeta, - UnsafeMeta: txMeta, }, LedgerHeader: &xdr.LedgerHeader{ LedgerSeq: xdr.Uint32(expectedTx.Ledger), diff --git a/exp/lighthorizon/ingester/mock_ingester.go b/exp/lighthorizon/ingester/mock_ingester.go index 3eb3f9a740..62c377ce78 100644 --- a/exp/lighthorizon/ingester/mock_ingester.go +++ b/exp/lighthorizon/ingester/mock_ingester.go @@ -3,6 +3,7 @@ package ingester import ( "context" + "github.com/stellar/go/historyarchive" "github.com/stellar/go/xdr" "github.com/stretchr/testify/mock" ) @@ -28,6 +29,11 @@ func (m *MockIngester) GetLedger(ctx context.Context, sequence uint32) (xdr.Seri return args.Get(0).(xdr.SerializedLedgerCloseMeta), args.Error(1) } +func (m *MockIngester) PrepareRange(ctx context.Context, r historyarchive.Range) error { + args := m.Called(ctx, r) + return args.Error(0) +} + type MockLedgerTransactionReader struct { mock.Mock }