Skip to content

Commit

Permalink
Fix Go integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Nov 28, 2023
1 parent af1ac65 commit 495b112
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions cmd/soroban-rpc/internal/test/get_ledger_entries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/test/get_ledger_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions cmd/soroban-rpc/internal/test/simulate_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 495b112

Please sign in to comment.