Page MenuHomePhabricator

[chronik] Fix websocket subscription in tests
ClosedPublic

Authored by Fabien on Feb 15 2024, 21:06.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABC019650ee386a: [chronik] Fix websocket subscription in tests
Summary

The tests expect the websocket subscription to take effect immediately, however this doesn't hold as the subscription is send via the network and can take some time to be received/processed. This diff uses the log to make sure the subscription happened before returning.

Test Plan
./test/functional/test_runner.py chronik_*

Diff Detail

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

Event Timeline

Fabien requested review of this revision.Feb 15 2024, 21:06

@bot build-linux-arm build-linux-aarch64

Don't break encapsulation

@bot build-linux-arm build-linux-aarch64

PiRK added a subscriber: PiRK.
PiRK added inline comments.
test/functional/test_framework/util.py
659–662 ↗(On Diff #45280)

Potential simplification.

>>> a = bytes.fromhex("deadbeef")
>>>
>>> repr(a)
"b'\\xde\\xad\\xbe\\xef'"
>>> str(a)
"b'\\xde\\xad\\xbe\\xef'">>> f"test: {a}".replace("'", '"')
'test: b"\\xde\\xad\\xbe\\xef"'
This revision is now accepted and ready to land.Feb 16 2024, 08:43
test/functional/test_framework/util.py
659–662 ↗(On Diff #45280)
>>> print(f"test: {a}".replace("'", '"'))
test: b"\xde\xad\xbe\xef"

Rebase, fix for new linter, update token id print format after D15463.

tobias_ruck added inline comments.
chronik/chronik-http/src/ws.rs
159–162 ↗(On Diff #45293)

maybe this even puts it back to 1 line