You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
edit 2025-08-18: this comment is outdated. Feel free to ignore.
An alternative to a NATS JetStream based approach could be a testing-extractor that publishes a fixed set of messages into a NATS server and clients read from it. This might be easier to implement and makes it easier to add new test cases since we don't need to recreate a NATS JetStream file to read from. A workflow for this would be similar to:
Spin up a NATS server in GH Actions (using Docker or binary).
Wait until NATS is ready.
Run a tool / consumer.
Run the testing-extractor / publisher (it should send a few test messages).
Assert/test that the tool output is as expected
A GH actions workflow to run a NATS server could look similar to:
The big thing missing here is the ebpf-extractor integration tests. These are probably a bit harder to do than the others because they also require root privileges to run. That's fine for the CI, but not ideal for local development.
I want to experiment with adding some custom tracepoints into Bitcoin Core and have them flow through to peer-observer, so looked into the ebpf tests within peer-observer, to find none, and this issue!
So it makes sense to get the ebpf tests sorted as the first order of business. The first step is thus a refactor of the ebpf-extractor to expose a testable run() function, matching the pattern of the rpc, log, and p2p extractors. This will give a slim main.rs and move mostly everything into a lib.rs.
Next would be writing the actual integration tests. The plan is to follow the same pattern as the other extractors (temp NATS server, regtest bitcoind, etc). As you note @0xB10C these tests will require Linux with eBPF support and root privileges so maybe some gating behind feature flag is required.
If you have any opinion or preferences on this, please let me know, otherwise I will use my best judgement and we'll find out at PR review time 😛
I don't want to recommend devs to run them locally due to their privilege requirements (especially if they aren't touching the ebpf-extractor in their code changes). This means introducing another feature flag for it, and not being able to run with --all-features locally. We can and should run them in CI. Maybe we can also implement a "skip", if the user does not have the right priviledges...
But def Concept ACK on adding tests for the ebpf-extractor in some way!
Activity
[-]Test tools[/-][+]Test the tools[/+]0xB10C commentedon Jul 7, 2025
This is still needed, however, we don't use nanomsg anymore. Instead, a NATS.io server is used. NATS allows us to record and replay messages with https://docs.nats.io/nats-concepts/jetstream which could be used to replay a recording during a test and feed it into a tool.
0xB10C commentedon Jul 7, 2025
edit 2025-08-18: this comment is outdated. Feel free to ignore.
An alternative to a NATS JetStream based approach could be a testing-extractor that publishes a fixed set of messages into a NATS server and clients read from it. This might be easier to implement and makes it easier to add new test cases since we don't need to recreate a NATS JetStream file to read from. A workflow for this would be similar to:A GH actions workflow to run a NATS server could look similar to:
mv: extractor to extractors/ebpf-extractors
mv: extractor to extractors/ebpf-extractors
0xB10C commentedon Jul 8, 2025
I moved the ebpf extractor into
extractors/, this allows us to have multiple extractors in this directory. For example, atesting-extractor.edit 2025-08-18: I don't think a separate testing-extractor is the way to go anymore. See #222 for the preferred approach.
add: first metrics tool integration tests
add: first metrics tool integration tests
add: first metrics tool integration tests
add: first metrics tool integration tests
add: first metrics tool integration tests
add: first metrics tool integration tests
add: first metrics tool integration tests
add: first metrics tool integration tests
0xB10C commentedon Aug 18, 2025
#222 implemented integration tests for the
metricstool by starting a testing-NATS server per test. This allows running multiple tests in parallel and makes sure there's no state left in NATS from a previous test. All other tools should be tested similarly. See https://github.com/0xB10C/peer-observer/blob/master/tools/metrics/tests/integration.rs[-]Test the tools[/-][+]Test the tools and extractors[/+][-]Test the tools and extractors[/-][+]Integration test the tools and extractors[/+]mv: extractor to extractors/ebpf-extractors
add: first metrics tool integration tests
0xB10C commentedon Oct 31, 2025
The big thing missing here is the ebpf-extractor integration tests. These are probably a bit harder to do than the others because they also require root privileges to run. That's fine for the CI, but not ideal for local development.
mv: extractor to extractors/ebpf-extractors
add: first metrics tool integration tests
deadmanoz commentedon Mar 13, 2026
I want to experiment with adding some custom tracepoints into Bitcoin Core and have them flow through to peer-observer, so looked into the ebpf tests within peer-observer, to find none, and this issue!
So it makes sense to get the ebpf tests sorted as the first order of business. The first step is thus a refactor of the ebpf-extractor to expose a testable
run()function, matching the pattern of the rpc, log, and p2p extractors. This will give a slimmain.rsand move mostly everything into alib.rs.Next would be writing the actual integration tests. The plan is to follow the same pattern as the other extractors (temp NATS server, regtest bitcoind, etc). As you note @0xB10C these tests will require Linux with eBPF support and root privileges so maybe some gating behind feature flag is required.
If you have any opinion or preferences on this, please let me know, otherwise I will use my best judgement and we'll find out at PR review time 😛
0xB10C commentedon Mar 13, 2026
(only saw this after my comment in #380, so reposting it here:
from #380 (comment)
But def Concept ACK on adding tests for the ebpf-extractor in some way!