Page MenuHomePhabricator

[Chronik] Add chronik_info method into lib.rs
ClosedPublic

Authored by hazzarust on Tue, Jan 14, 20:48.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABCf7d1497b7029: [Chronik] Add chronik_info method into lib.rs
Summary

Lets us retrieve the ChronikInfo struct, which we can then extract the version from. The assert_eq!() needs a regex, as when the remote is updated, it will return a different String (with the same formatting which we can use for pattern matching).

Test Plan

ninja-check-functional && cargo test in bitcoin-abc/modules/bitcoinsuite-chronik-client

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Tue, Jan 14, 20:48
Fabien requested changes to this revision.Tue, Jan 14, 20:51
Fabien added a subscriber: Fabien.
Fabien added inline comments.
modules/bitcoinsuite-chronik-client/tests/test_chronik_client.rs
334 ↗(On Diff #52193)

Can you minimally check the output as well ?
It should contain a "version" key and look something like "v0.30.9-a19427fa9855" so you can at least check the string starts with 'v' and the dot separated digits. This is a simple regex.

This revision now requires changes to proceed.Tue, Jan 14, 20:51

Added assert_eq!() test for chronik version returned

Fabien requested changes to this revision.Tue, Jan 14, 21:00
Fabien added inline comments.
modules/bitcoinsuite-chronik-client/tests/test_chronik_client.rs
334 ↗(On Diff #52194)

This doesn't work. You're testing against a specific version, so as soon as the remote is updated this will start to fail, despite your endpoint being correct.
Use a regex to match a version.

This revision now requires changes to proceed.Tue, Jan 14, 21:00
hazzarust marked an inline comment as done.

Added the regex test for version returned from ChronikInfo

hazzarust retitled this revision from [Chronik] Added chronik_info method into lib.rs to retrieve ChronikInfo struct and thus the version to [Chronik] Add chronik_info method into lib.rs.Tue, Jan 14, 21:37
hazzarust edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Tue, Jan 14, 22:03