Skip to content

ethclient, accounts/keystore: fix flaky tests#23599

Merged
holiman merged 2 commits intoethereum:masterfrom
holiman:fix_gethclient_flakeytest
Sep 20, 2021
Merged

ethclient, accounts/keystore: fix flaky tests#23599
holiman merged 2 commits intoethereum:masterfrom
holiman:fix_gethclient_flakeytest

Conversation

@holiman
Copy link
Copy Markdown
Contributor

@holiman holiman commented Sep 18, 2021

This PR fixes a flaky test, ethclient/gethclient: TestGethClient. The reason it was flaky was that the table-driven test was actually a map-driven test, and the key order when iterating over the map is undefined. Some of the tests (particularly the setHead test) modifies the backend chain, which is problematic for the access list test, which fails if the basefee is too high.

So this PR changes it to use a list instead.

Example failure: https://ci.appveyor.com/project/ethereum/go-ethereum/builds/40814331/job/oh9s50w4lgcxge8d#L821

@holiman
Copy link
Copy Markdown
Contributor Author

holiman commented Sep 18, 2021

Another failing test:https://ci.appveyor.com/project/ethereum/go-ethereum/builds/40820338/job/4bm6h7cmv95l1u69#L713

This one is due to unixNano mainly being not-nano on windows, so the two tests reuse the same keystore. Fixed by modifying the folder names to no longer collide.

@holiman holiman changed the title ethclient/gethclient: fix flaky test (due to map key ordering) ethclient, accounts/keystore: fix flaky tests Sep 18, 2021
@holiman holiman force-pushed the fix_gethclient_flakeytest branch from 7854516 to 6473dcd Compare September 18, 2021 21:39
Copy link
Copy Markdown
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holiman holiman force-pushed the fix_gethclient_flakeytest branch from 6473dcd to 1ecf179 Compare September 20, 2021 07:41
@holiman holiman added this to the 1.10.9 milestone Sep 20, 2021
@holiman holiman merged commit 1b34283 into ethereum:master Sep 20, 2021
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this pull request Dec 3, 2022
* 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
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 24, 2025
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants