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

fullblocktests: Decouple from blockchain. #2951

Merged
merged 5 commits into from May 30, 2022

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented May 14, 2022

The blockchain/fullblocktests package currently has a cyclic dependency on blockchain since the tests directly return the error codes in blockchain that are expected to be violated while blockchain itself needs to import the package in order to run the tests.

This resolves that cyclic dependency by defining all of the errors the fullblocktests produce in the package itself and then converting them to the associated error in blockchain when running the tests and checking for the expected error.

It also moves the code that runs the fullblocktests into the blockchain package itself instead of a separate blockchain_test package to match all other tests now that there is no longer a cyclic dependency that forced it to be be separated.

While duplication of the errors in question is a little less convenient, this approach ensures the blockchain package can be made internal in the future while still providing the publicly-available fullblocktests package for use both in testing the internal blockchain implementation as well as integration tests with other implementations.

Finally, this also has a few other commits with some minor cleanup.

@davecgh davecgh added this to the 1.8.0 milestone May 14, 2022
blockchain/fullblocktests/error.go Outdated Show resolved Hide resolved
blockchain/fullblocktests/error.go Outdated Show resolved Hide resolved
blockchain/fullblocktests/error.go Outdated Show resolved Hide resolved
@davecgh davecgh force-pushed the blockchain_decouple_fullblocktests branch from c1e3a66 to a98bbba Compare May 20, 2022 16:23
@davecgh davecgh force-pushed the blockchain_decouple_fullblocktests branch from a98bbba to ca29669 Compare May 27, 2022 18:08
This renames the error returned when there is no treasury payout present
in a coinbase and/or treasurybase to match its actual meaning.
The blockchain/fullblocktests package currently has a cyclic dependency
on blockchain since the tests directly return the error codes in
blockchain that are expected to be violated while blockchain itself
needs to import the package in order to run the tests.

This resolves that cyclic dependency by defining all of the errors the
fullblocktests produce in the package itself and then converting them to
the associated error in blockchain when running the tests and checking
for the expected error.

It also moves the code that runs the fullblocktests into the blockchain
itself instead of a separate blockchain_test to match all other tests
now that there is no longer a cyclic dependency that forced it to be
be separated.

While duplication of the errors in question is a little less convenient,
this approach ensures the blockchain package can be made internal in the
future while still providing the publicly-available fullblocktests
package for use both in testing the internal blockchain implementation
as well as integration tests with other implementations.
@davecgh davecgh force-pushed the blockchain_decouple_fullblocktests branch from ca29669 to b767607 Compare May 30, 2022 16:28
@davecgh davecgh merged commit b767607 into decred:master May 30, 2022
@davecgh davecgh deleted the blockchain_decouple_fullblocktests branch May 30, 2022 16:41
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.

None yet

4 participants