diff --git a/internal/input/changes_test.go b/internal/input/changes_test.go index 79c4cb4f..cabed9ca 100644 --- a/internal/input/changes_test.go +++ b/internal/input/changes_test.go @@ -2,7 +2,6 @@ package input import ( "testing" - "time" "github.com/stellar/go/ingest" "github.com/stellar/go/ingest/ledgerbackend" @@ -115,12 +114,12 @@ func TestSendBatchToChannel(t *testing.T) { } func wrapLedgerEntry(entryType xdr.LedgerEntryType, entry xdr.LedgerEntry) ChangeBatch { - changes := map[xdr.LedgerEntryType]ChangesClosedAt{ + changes := map[xdr.LedgerEntryType]LedgerChanges{ entryType: { Changes: []ingest.Change{ {Type: entry.Data.Type, Post: &entry}, }, - ClosedAts: []time.Time{}, + LedgerHeaders: []xdr.LedgerHeaderHistoryEntry{}, }, } return ChangeBatch{ @@ -134,7 +133,7 @@ func mockExtractBatch( env utils.EnvironmentDetails, logger *utils.EtlLogger) ChangeBatch { log.Errorf("mock called") return ChangeBatch{ - Changes: map[xdr.LedgerEntryType]ChangesClosedAt{}, + Changes: map[xdr.LedgerEntryType]LedgerChanges{}, BatchStart: batchStart, BatchEnd: batchEnd, } diff --git a/internal/transform/account_signer_test.go b/internal/transform/account_signer_test.go index 7de456ab..0a0306ca 100644 --- a/internal/transform/account_signer_test.go +++ b/internal/transform/account_signer_test.go @@ -51,8 +51,15 @@ func TestTransformAccountSigner(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformSigners(test.input.injest, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformSigners(test.input.injest, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -131,6 +138,8 @@ func makeSignersTestOutput() []AccountSignerOutput { LastModifiedLedger: 30705278, LedgerEntryChange: 2, Deleted: true, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, { AccountID: testAccount1ID.Address(), Signer: "GACAKBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB3BQ", @@ -139,6 +148,8 @@ func makeSignersTestOutput() []AccountSignerOutput { LastModifiedLedger: 30705278, LedgerEntryChange: 2, Deleted: true, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, { AccountID: testAccount1ID.Address(), Signer: "GAFAWDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNDC", @@ -147,6 +158,8 @@ func makeSignersTestOutput() []AccountSignerOutput { LastModifiedLedger: 30705278, LedgerEntryChange: 2, Deleted: true, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, } } diff --git a/internal/transform/account_test.go b/internal/transform/account_test.go index 42befbb1..c99b66fc 100644 --- a/internal/transform/account_test.go +++ b/internal/transform/account_test.go @@ -95,8 +95,15 @@ func TestTransformAccount(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformAccount(test.input.ledgerChange, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformAccount(test.input.ledgerChange, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -183,5 +190,7 @@ func makeAccountTestOutput() AccountOutput { LastModifiedLedger: 30705278, LedgerEntryChange: 2, Deleted: true, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), } } diff --git a/internal/transform/claimable_balance_test.go b/internal/transform/claimable_balance_test.go index 24a2d374..90690fa1 100644 --- a/internal/transform/claimable_balance_test.go +++ b/internal/transform/claimable_balance_test.go @@ -35,8 +35,15 @@ func TestTransformClaimableBalance(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformClaimableBalance(test.input.ingest, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformClaimableBalance(test.input.ingest, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -117,5 +124,7 @@ func makeClaimableBalanceTestOutput() ClaimableBalanceOutput { LastModifiedLedger: 30705278, LedgerEntryChange: 2, Deleted: true, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), } } diff --git a/internal/transform/config_setting_test.go b/internal/transform/config_setting_test.go index 169789c0..5d94498c 100644 --- a/internal/transform/config_setting_test.go +++ b/internal/transform/config_setting_test.go @@ -44,8 +44,15 @@ func TestTransformConfigSetting(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformConfigSetting(test.input, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformConfigSetting(test.input, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -126,6 +133,8 @@ func makeConfigSettingTestOutput() []ConfigSettingOutput { LastModifiedLedger: 24229503, LedgerEntryChange: 1, Deleted: false, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, } } diff --git a/internal/transform/contract_code_test.go b/internal/transform/contract_code_test.go index e4691015..9a47e4dc 100644 --- a/internal/transform/contract_code_test.go +++ b/internal/transform/contract_code_test.go @@ -44,8 +44,15 @@ func TestTransformContractCode(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformContractCode(test.input, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformContractCode(test.input, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -84,6 +91,8 @@ func makeContractCodeTestOutput() []ContractCodeOutput { LastModifiedLedger: 24229503, LedgerEntryChange: 1, Deleted: false, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, } } diff --git a/internal/transform/contract_data_test.go b/internal/transform/contract_data_test.go index 578d0f3d..2c5234d5 100644 --- a/internal/transform/contract_data_test.go +++ b/internal/transform/contract_data_test.go @@ -48,9 +48,16 @@ func TestTransformContractData(t *testing.T) { } for _, test := range tests { - var closedAt time.Time + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } TransformContractData := NewTransformContractDataStruct(MockAssetFromContractData, MockContractBalanceFromContractData) - actualOutput, actualError, _ := TransformContractData.TransformContractData(test.input, test.passphrase, closedAt) + actualOutput, actualError, _ := TransformContractData.TransformContractData(test.input, test.passphrase, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -129,6 +136,8 @@ func makeContractDataTestOutput() []ContractDataOutput { LastModifiedLedger: 24229503, LedgerEntryChange: 1, Deleted: false, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, } } diff --git a/internal/transform/expiration_test.go b/internal/transform/expiration_test.go index ac1cef9d..d28a6d46 100644 --- a/internal/transform/expiration_test.go +++ b/internal/transform/expiration_test.go @@ -44,8 +44,15 @@ func TestTransformExpiration(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformExpiration(test.input, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformExpiration(test.input, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -93,6 +100,8 @@ func makeExpirationTestOutput() []ExpirationOutput { LastModifiedLedger: 1, LedgerEntryChange: 1, Deleted: false, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, } } diff --git a/internal/transform/liquidity_pool_test.go b/internal/transform/liquidity_pool_test.go index 07dc25e2..8a60f59d 100644 --- a/internal/transform/liquidity_pool_test.go +++ b/internal/transform/liquidity_pool_test.go @@ -47,8 +47,15 @@ func TestTransformPool(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformPool(test.input.ingest, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformPool(test.input.ingest, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -118,5 +125,7 @@ func makePoolTestOutput() PoolOutput { LastModifiedLedger: 30705278, LedgerEntryChange: 2, Deleted: true, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), } } diff --git a/internal/transform/offer_test.go b/internal/transform/offer_test.go index 268acc9c..303693eb 100644 --- a/internal/transform/offer_test.go +++ b/internal/transform/offer_test.go @@ -97,8 +97,15 @@ func TestTransformOffer(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformOffer(test.input.ingest, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformOffer(test.input.ingest, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -171,5 +178,7 @@ func makeOfferTestOutput() OfferOutput { LedgerEntryChange: 2, Deleted: true, Sponsor: null.StringFrom(testAccount3Address), + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), } } diff --git a/internal/transform/trustline_test.go b/internal/transform/trustline_test.go index 87846b74..24efa2f5 100644 --- a/internal/transform/trustline_test.go +++ b/internal/transform/trustline_test.go @@ -50,8 +50,15 @@ func TestTransformTrustline(t *testing.T) { } for _, test := range tests { - var closedAt time.Time - actualOutput, actualError := TransformTrustline(test.input.ingest, closedAt) + header := xdr.LedgerHeaderHistoryEntry{ + Header: xdr.LedgerHeader{ + ScpValue: xdr.StellarValue{ + CloseTime: 1000, + }, + LedgerSeq: 10, + }, + } + actualOutput, actualError := TransformTrustline(test.input.ingest, header) assert.Equal(t, test.wantErr, actualError) assert.Equal(t, test.wantOutput, actualOutput) } @@ -133,6 +140,8 @@ func makeTrustlineTestOutput() []TrustlineOutput { LastModifiedLedger: 24229503, LedgerEntryChange: 1, Deleted: false, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, { LedgerKey: "AAAAAQAAAAAcR0GXGO76pFs4y38vJVAanjnLg4emNun7zAx0pHcDGAAAAAMBAwQFBwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", @@ -148,6 +157,8 @@ func makeTrustlineTestOutput() []TrustlineOutput { LastModifiedLedger: 123456789, LedgerEntryChange: 1, Deleted: false, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), }, } }