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

tests: split consensus tests into separate files for each chain type … #3168

Merged

Conversation

JosephGoulden
Copy link
Contributor

CHAIN_TYPE in global.rs is shared global state and we have multiple tests that modify this state through global::set_mining_mode(). Each Rust test target (file) is run with multiple threads, so the tests with shared state cannot be sure that the state is correct (chain_type could be modified by another test thread) causing intermittent failures.

I suggest we separate tests into different files depending on the chain type they need as I have done in this change. That way we can keep the global state, which is convenient and still run tests for the same chain type in parallel.

…to avoid non deterministic behaviour due to shared global state in global.rs
Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

Looking very good see comment below.

Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

Looking very good. I think we could keep a consensus.rs file around for tests such as this one https://github.com/mimblewimble/grin/pull/3178/files#diff-0e42d6d281665de4ca0d262d0db8550eR575. I think fixing the merge conflict will lead you to this.

@JosephGoulden
Copy link
Contributor Author

JosephGoulden commented Jan 22, 2020

I fixed the conflicts.

What exactly would you suggest to put in consensus.rs? As far as I can see it would be empty (there are no consensus integration tests that don't call global::set_mining_mode()).

Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

Nevermind :). Merging.

@quentinlesceller quentinlesceller merged commit a1b6c31 into mimblewimble:master Jan 27, 2020
@antiochp antiochp mentioned this pull request Feb 24, 2020
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