Skip to content

test: Use mocktime to avoid intermittent failure in rpc_tests - #21676

Merged
maflcko merged 2 commits into
bitcoin:masterfrom
maflcko:2104-testFixMocktime
Apr 15, 2021
Merged

maflcko merged 2 commits into
bitcoin:masterfrom
maflcko:2104-testFixMocktime

Conversation

@maflcko

@maflcko maflcko commented Apr 14, 2021

Copy link
Copy Markdown
Member

@fanquake

Copy link
Copy Markdown
Member

Concept ACK

@jonatack jonatack left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tACK fabc39f3563b027f5750cad2f41ecbde80dd7f5f with light code review, some comments

@jonatack

jonatack commented Apr 14, 2021 •

Copy link
Copy Markdown
Member

What about these

src/test/miner_tests.cpp:512:    SetMockTime(0);
src/wallet/test/wallet_tests.cpp:299:    SetMockTime(0);
src/wallet/test/wallet_tests.cpp:382:    SetMockTime(0);

Comment thread src/test/util/setup_common.cpp Resolved
@DrahtBot

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Doing it there will reduce code bloat and also ensure no test can "forget" to reset it
@maflcko
maflcko force-pushed the 2104-testFixMocktime branch from fabc39f to fa40d6a Compare April 14, 2021 15:38

@jarolrod jarolrod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK fa40d6a

This gives us tighter control of time and will prevent any time slippage making this test fail. I couldn't make the banned time test fail in practice, but this prevents that.

@jonatack

Copy link
Copy Markdown
Member

Code review ACK fa40d6a

@maflcko
maflcko merged commit a5e756b into bitcoin:master Apr 15, 2021
@maflcko
maflcko deleted the 2104-testFixMocktime branch April 15, 2021 08:08
@maflcko

maflcko commented Apr 15, 2021

Copy link
Copy Markdown
Member Author

As predicted, this happens in practice:

test/rpc_tests.cpp(292): error: in "rpc_tests/rpc_ban": check time_remaining == banned_until - now has failed [200 != 199]

https://cirrus-ci.com/task/5877648200040448?logs=ci#L7931

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants