ethclient, accounts/keystore: fix flaky tests (#23599)

* ethclient/gethclient: fix flaky test (due to map key ordering)

* accounts/keystore: fix test failing due to rand collision due to low time resolution on windows
This commit is contained in:
Martin Holst Swende
2021-09-20 10:23:44 +02:00
committed by GitHub
parent 401354976b
commit 1b34283810
2 changed files with 22 additions and 19 deletions

View File

@ -97,37 +97,40 @@ func TestGethClient(t *testing.T) {
defer backend.Close()
defer client.Close()
tests := map[string]struct {
tests := []struct {
name string
test func(t *testing.T)
}{
"TestAccessList": {
{
"TestAccessList",
func(t *testing.T) { testAccessList(t, client) },
},
"TestGetProof": {
{
"TestGetProof",
func(t *testing.T) { testGetProof(t, client) },
},
"TestGCStats": {
}, {
"TestGCStats",
func(t *testing.T) { testGCStats(t, client) },
},
"TestMemStats": {
}, {
"TestMemStats",
func(t *testing.T) { testMemStats(t, client) },
},
"TestGetNodeInfo": {
}, {
"TestGetNodeInfo",
func(t *testing.T) { testGetNodeInfo(t, client) },
},
"TestSetHead": {
}, {
"TestSetHead",
func(t *testing.T) { testSetHead(t, client) },
},
"TestSubscribePendingTxs": {
}, {
"TestSubscribePendingTxs",
func(t *testing.T) { testSubscribePendingTransactions(t, client) },
},
"TestCallContract": {
}, {
"TestCallContract",
func(t *testing.T) { testCallContract(t, client) },
},
}
t.Parallel()
for name, tt := range tests {
t.Run(name, tt.test)
for _, tt := range tests {
t.Run(tt.name, tt.test)
}
}