From 495b1129b3c47ba6e01400dd7016400c73431453 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 28 Nov 2023 01:36:57 +0100 Subject: [PATCH] Fix Go integration tests --- .../internal/test/get_ledger_entries_test.go | 12 ++++++------ .../internal/test/get_ledger_entry_test.go | 2 +- .../internal/test/simulate_transaction_test.go | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/soroban-rpc/internal/test/get_ledger_entries_test.go b/cmd/soroban-rpc/internal/test/get_ledger_entries_test.go index 728f4d46b..46b0b25dd 100644 --- a/cmd/soroban-rpc/internal/test/get_ledger_entries_test.go +++ b/cmd/soroban-rpc/internal/test/get_ledger_entries_test.go @@ -52,7 +52,7 @@ func TestGetLedgerEntriesNotFound(t *testing.T) { require.NoError(t, err) assert.Equal(t, 0, len(result.Entries)) - assert.Greater(t, result.LatestLedger, int64(0)) + assert.Greater(t, result.LatestLedger, uint32(0)) } func TestGetLedgerEntriesInvalidParams(t *testing.T) { @@ -153,22 +153,22 @@ func TestGetLedgerEntriesSucceeds(t *testing.T) { err = client.CallResult(context.Background(), "getLedgerEntries", request, &result) require.NoError(t, err) require.Equal(t, 2, len(result.Entries)) - require.Greater(t, result.LatestLedger, int64(0)) + require.Greater(t, result.LatestLedger, uint32(0)) - require.Greater(t, result.Entries[0].LastModifiedLedger, int64(0)) + require.Greater(t, result.Entries[0].LastModifiedLedger, uint32(0)) require.LessOrEqual(t, result.Entries[0].LastModifiedLedger, result.LatestLedger) require.NotNil(t, result.Entries[0].LiveUntilLedgerSeq) - require.Greater(t, *result.Entries[0].LiveUntilLedgerSeq, uint32(result.LatestLedger)) + require.Greater(t, *result.Entries[0].LiveUntilLedgerSeq, result.LatestLedger) require.Equal(t, contractCodeKeyB64, result.Entries[0].Key) var firstEntry xdr.LedgerEntryData require.NoError(t, xdr.SafeUnmarshalBase64(result.Entries[0].XDR, &firstEntry)) require.Equal(t, xdr.LedgerEntryTypeContractCode, firstEntry.Type) require.Equal(t, contractBinary, firstEntry.MustContractCode().Code) - require.Greater(t, result.Entries[1].LastModifiedLedger, int64(0)) + require.Greater(t, result.Entries[1].LastModifiedLedger, uint32(0)) require.LessOrEqual(t, result.Entries[1].LastModifiedLedger, result.LatestLedger) require.NotNil(t, result.Entries[1].LiveUntilLedgerSeq) - require.Greater(t, *result.Entries[1].LiveUntilLedgerSeq, uint32(result.LatestLedger)) + require.Greater(t, *result.Entries[1].LiveUntilLedgerSeq, result.LatestLedger) require.Equal(t, contractInstanceKeyB64, result.Entries[1].Key) var secondEntry xdr.LedgerEntryData require.NoError(t, xdr.SafeUnmarshalBase64(result.Entries[1].XDR, &secondEntry)) diff --git a/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go b/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go index f30af115f..dd4879d53 100644 --- a/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go +++ b/cmd/soroban-rpc/internal/test/get_ledger_entry_test.go @@ -107,7 +107,7 @@ func TestGetLedgerEntrySucceeds(t *testing.T) { var result methods.GetLedgerEntryResponse err = client.CallResult(context.Background(), "getLedgerEntry", request, &result) assert.NoError(t, err) - assert.Greater(t, result.LatestLedger, int64(0)) + assert.Greater(t, result.LatestLedger, uint32(0)) assert.GreaterOrEqual(t, result.LatestLedger, result.LastModifiedLedger) var entry xdr.LedgerEntryData assert.NoError(t, xdr.SafeUnmarshalBase64(result.XDR, &entry)) diff --git a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go index b47c609f0..99ebd99a8 100644 --- a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go +++ b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go @@ -216,7 +216,7 @@ func TestSimulateTransactionSucceeds(t *testing.T) { contractHash := sha256.Sum256(contractBinary) contractHashBytes := xdr.ScBytes(contractHash[:]) expectedXdr := xdr.ScVal{Type: xdr.ScValTypeScvBytes, Bytes: &contractHashBytes} - assert.Greater(t, result.LatestLedger, int64(0)) + assert.Greater(t, result.LatestLedger, uint32(0)) assert.Greater(t, result.Cost.CPUInstructions, uint64(0)) assert.Greater(t, result.Cost.MemoryBytes, uint64(0)) @@ -578,7 +578,7 @@ func TestSimulateTransactionError(t *testing.T) { }, } result := simulateTransactionFromTxParams(t, client, params) - assert.Greater(t, result.LatestLedger, int64(0)) + assert.Greater(t, result.LatestLedger, uint32(0)) assert.Contains(t, result.Error, "MissingValue") require.Len(t, result.Events, 1) var event xdr.DiagnosticEvent