Page MenuHomePhabricator

[chronik] Add an integration test for the blockchain_info endpoint in bitcoinsuite-chronik-client
AcceptedPublic

Authored by hazzarust on Tue, Feb 4, 23:05.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Summary

Depends on D17595 - this diff uses features from D17595 files test_runner.rs and handler.rs.

Use the bitcoinsuite-chronik-client to return the tip height and tip hash length, thus we can compare with the python bitcoin tests and assert if they are equal.

Test Plan

Please set BUILD_DIR env to export BUILD_DIR="/path/to/build_dir
UNIX: ./contrib/teamcity/build-configurations.py build-bitcoinsuite-chronik-client
cd modules/bitcoinsuite-chronik-client && cargo test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
blockchain_info
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32469
Build 64426: Build Diffbuild-bitcoinsuite-chronik-client
Build 64425: arc lint + arc unit

Event Timeline

hazzarust created this revision.
hazzarust edited the test plan for this revision. (Show Details)
PiRK added a parent revision: Restricted Differential Revision.
PiRK added inline comments.
modules/bitcoinsuite-chronik-client/tests/blockchain_info.rs
16 ↗(On Diff #52524)

you probably want to use a cross platform function here (maybe std::env::temp_dir()?), just so we don't introduce issues in case we want to run tests on windows some day

Fabien requested changes to this revision.Mon, Feb 10, 11:09
Fabien added a subscriber: Fabien.

See the feedback from D17595: remove the debug statements, and rebase. The suggestion from Pierre is also a good one that you should take into account. Otherwise the state machine looks good to me.

This revision now requires changes to proceed.Mon, Feb 10, 11:09
hazzarust edited the summary of this revision. (Show Details)

Revamped blockchain_info to include the new trait changes.

I will make the changes from Pierre's comment in a separate diff to all current integration tests.

Quoted Text you probably want to use a cross platform function here (maybe std::env::temp_dir()?), just so we don't introduce issues in case we want to run tests on windows some day

Fabien requested changes to this revision.Thu, Feb 20, 19:46

The title and the file name are incorrect, please fix this before the review

This revision now requires changes to proceed.Thu, Feb 20, 19:46
hazzarust retitled this revision from [chronik] Add blockchain_info to bitcoinsuite-chronik-client to [chronik] Add an integration test for the blockchain_info endpoint in bitcoinsuite-chronik-client.Thu, Feb 20, 22:36
hazzarust edited the summary of this revision. (Show Details)

Renamed blockchain_info_new to blockchain_info

Fabien requested changes to this revision.Fri, Feb 21, 08:45
Fabien added inline comments.
modules/bitcoinsuite-chronik-client/tests/blockchain_info.rs
24 ↗(On Diff #52696)

it's not testing anything. Call it get_blockchain_info instead

70 ↗(On Diff #52696)

Please add a comment to explain briefly what the step does (mine a block, park a block, invalidate a block etc.)

120 ↗(On Diff #52696)

This should raise an error. Since step 0 is handled in the switch this is expected to be unreachable

This revision now requires changes to proceed.Fri, Feb 21, 08:45

Added unreachable panic, renamed test_blockchain_info to blockchain_info and added comments

Fabien requested changes to this revision.Fri, Feb 21, 18:01

Please make the linter happy

This revision now requires changes to proceed.Fri, Feb 21, 18:01
This revision is now accepted and ready to land.Mon, Feb 24, 08:25

Maybe we could actually print to stdout what step is running and what it does instead of the comment, since stdout is captured by default and not shown upon success. But we can do that later if it feels necessary.

Fabien requested changes to this revision.Mon, Feb 24, 08:38
Fabien added inline comments.
modules/bitcoinsuite-chronik-client/tests/blockchain_info.rs
147 ↗(On Diff #52723)

Please rename, you're not testing the ipc

This revision now requires changes to proceed.Mon, Feb 24, 08:38

Rename blockchain_info_ipc

Fabien requested changes to this revision.Mon, Feb 24, 19:41
Fabien added inline comments.
modules/bitcoinsuite-chronik-client/tests/blockchain_info.rs
66 ↗(On Diff #52729)

Why do you need the line continuation \ here...

95 ↗(On Diff #52729)

Please keep the code consistent and use an assert message everywhere or nowhere

130 ↗(On Diff #52729)

...but not here ? Please keep it consistent

130 ↗(On Diff #52723)

This is not a very good message. The issue is that you got an unexpected extra "ready" message from the setup framework. "Counter" is just the name of a variable, nothing another dev can reason about without knowing the code

This revision now requires changes to proceed.Mon, Feb 24, 19:41

Updated !unreachable() comment and removed assert comments

Fabien requested changes to this revision.Mon, Feb 24, 20:34
Fabien added inline comments.
modules/bitcoinsuite-chronik-client/tests/blockchain_info.rs
121 ↗(On Diff #52740)

wtf, some lines have \ some don't. \o/
Fix the layout

This revision now requires changes to proceed.Mon, Feb 24, 20:34
modules/bitcoinsuite-chronik-client/tests/blockchain_info.rs
121 ↗(On Diff #52740)

This is the linter. I will fix

Updating comment (linter plz dont kill me )

This revision is now accepted and ready to land.Tue, Feb 25, 09:53