Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the e2e group 5 and group 8 have a probability run fail #2776

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions test/e2e/debug_calltracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func TestDebugTraceBlockCallTracer(t *testing.T) {
},
}

results := map[string]json.RawMessage{}
results := map[string][]interface{}{}

type testCase struct {
name string
Expand Down Expand Up @@ -399,25 +399,23 @@ func TestDebugTraceBlockCallTracer(t *testing.T) {
require.Nil(t, response.Error)
require.NotNil(t, response.Result)

results[network.Name] = response.Result
resultTransactions := []interface{}{}
err = json.Unmarshal(response.Result, &resultTransactions)
require.NoError(t, err)

results[network.Name] = []interface{}{resultTransactions[receipt.TransactionIndex]}
}

referenceTransactions := []interface{}{}
err = json.Unmarshal(results[l1NetworkName], &referenceTransactions)
require.NoError(t, err)
referenceTransactions := results[l1NetworkName]

for networkName, result := range results {
if networkName == l1NetworkName {
continue
}

resultTransactions := []interface{}{}
err = json.Unmarshal(result, &resultTransactions)
require.NoError(t, err)

for transactionIndex := range referenceTransactions {
referenceTransactionMap := referenceTransactions[transactionIndex].(map[string]interface{})
resultTransactionMap := resultTransactions[transactionIndex].(map[string]interface{})
resultTransactionMap := result[transactionIndex].(map[string]interface{})

compareCallFrame(t, referenceTransactionMap, resultTransactionMap, networkName)
}
Expand Down
20 changes: 9 additions & 11 deletions test/e2e/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ func TestDebugTraceBlock(t *testing.T) {
},
}

results := map[string]json.RawMessage{}
results := map[string][]interface{}{}

type testCase struct {
name string
Expand Down Expand Up @@ -601,35 +601,33 @@ func TestDebugTraceBlock(t *testing.T) {
require.Nil(t, response.Error)
require.NotNil(t, response.Result)

results[network.Name] = response.Result
resultTransactions := []interface{}{}
err = json.Unmarshal(response.Result, &resultTransactions)
require.NoError(t, err)

results[network.Name] = []interface{}{resultTransactions[receipt.TransactionIndex]}
}

referenceTransactions := []interface{}{}
err = json.Unmarshal(results[l1NetworkName], &referenceTransactions)
require.NoError(t, err)
referenceTransactions := results[l1NetworkName]

for networkName, result := range results {
if networkName == l1NetworkName {
continue
}

resultTransactions := []interface{}{}
err = json.Unmarshal(result, &resultTransactions)
require.NoError(t, err)

for transactionIndex := range referenceTransactions {
referenceTransactionMap := referenceTransactions[transactionIndex].(map[string]interface{})
referenceResultMap := referenceTransactionMap["result"].(map[string]interface{})
referenceStructLogsMap := referenceResultMap["structLogs"].([]interface{})

resultTransactionMap := resultTransactions[transactionIndex].(map[string]interface{})
resultTransactionMap := result[transactionIndex].(map[string]interface{})
resultResultMap := resultTransactionMap["result"].(map[string]interface{})
resultStructLogsMap := resultResultMap["structLogs"].([]interface{})
log.Debugf("test[%s] referenceStructLogsMap : L1_len=%d L2_len=%d", tc.name, len(referenceStructLogsMap), len(resultStructLogsMap))
if len(referenceStructLogsMap) != len(resultStructLogsMap) {
log.Debugf("test[%s] referenceStructLogsMap not equal", tc.name)
log.Debug("L1 (referenceTransactions): ", referenceTransactions)
log.Debug("L2 (resultTransactions): ", resultTransactions)
log.Debug("L2 (resultTransactions): ", result)
}
require.Equal(t, len(referenceStructLogsMap), len(resultStructLogsMap))

Expand Down