Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Apr 15, 2024
1 parent 989b62b commit 0fd535a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions cmd/soroban-rpc/internal/preflight/preflight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ var mockLedgerEntriesWithoutTTLs = []xdr.LedgerEntry{
Data: xdr.LedgerEntryData{
Type: xdr.LedgerEntryTypeConfigSetting,
ConfigSetting: &xdr.ConfigSettingEntry{
ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractCostParamsCpuInstructions,
// Obtained with TestGetLedgerEntryConfigSettings
ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractCostParamsCpuInstructions,
ContractCostParamsCpuInsns: contractCostParams,
},
},
Expand All @@ -184,8 +183,7 @@ var mockLedgerEntriesWithoutTTLs = []xdr.LedgerEntry{
Data: xdr.LedgerEntryData{
Type: xdr.LedgerEntryTypeConfigSetting,
ConfigSetting: &xdr.ConfigSettingEntry{
ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractCostParamsMemoryBytes,
// Obtained with TestGetLedgerEntryConfigSettings
ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractCostParamsMemoryBytes,
ContractCostParamsMemBytes: contractCostParams,
},
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/soroban-rpc/internal/test/simulate_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func TestSimulateTransactionSucceeds(t *testing.T) {
// for test purposes, the most deterministic way to assert the resulting fee is expected value in test scope, is to capture
// the resulting fee from current preflight output and re-plug it in here, rather than try to re-implement the cost-model algo
// in the test.
ResourceFee: 118357,
ResourceFee: 149755,
}

// First, decode and compare the transaction data so we get a decent diff if it fails.
Expand Down Expand Up @@ -560,7 +560,7 @@ func TestSimulateInvokeContractTransactionSucceeds(t *testing.T) {
require.Contains(t, metrics, "soroban_rpc_json_rpc_request_duration_seconds_count{endpoint=\"simulateTransaction\",status=\"ok\"} 3")
require.Contains(t, metrics, "soroban_rpc_preflight_pool_request_ledger_get_duration_seconds_count{status=\"ok\",type=\"db\"} 3")
require.Contains(t, metrics, "soroban_rpc_preflight_pool_request_ledger_get_duration_seconds_count{status=\"ok\",type=\"all\"} 3")
require.Contains(t, metrics, "soroban_rpc_preflight_pool_request_ledger_entries_fetched_sum 60")
require.Contains(t, metrics, "soroban_rpc_preflight_pool_request_ledger_entries_fetched_sum 65")
}

func TestSimulateTransactionError(t *testing.T) {
Expand Down Expand Up @@ -1144,7 +1144,7 @@ func TestSimulateSystemEvent(t *testing.T) {
// for test purposes, the most deterministic way to assert the resulting fee is expected value in test scope, is to capture
// the resulting fee from current preflight output and re-plug it in here, rather than try to re-implement the cost-model algo
// in the test.
assert.InDelta(t, 85360, int64(transactionData.ResourceFee), 5000)
assert.InDelta(t, 70668, int64(transactionData.ResourceFee), 5000)
assert.InDelta(t, 104, uint32(transactionData.Resources.WriteBytes), 15)
require.GreaterOrEqual(t, len(response.Events), 3)
}

0 comments on commit 0fd535a

Please sign in to comment.