Closed MatteoNardi closed 2 years ago
Yesterday I was talking to @banditopazzo about this issue and we kind of agreed that it would be better to run the test suit with something different from cargo test
. Probably the best solution would be to make an xtask for it.
The default test harness (libtest) doesn't seem to be extensible (See https://www.infinyon.com/blog/2021/04/rust-custom-test-harness/). I definitely want to maintain most of its features though, filtering support in particular is a must-have.
These are the alternatives which came up in my search:
[test]
attribute, but seems great for building a self-managed test suiteCurrently, the solution I have in mind would be something like this:
test
target
-monitor
module, so I would go for a separate test-suite binary crate.test-suite
crate which uses libtest-mimic
and collects every test case.
test_suite
feature which enables the testing code
Running cargo test from the root folder or from
validatron/derive
fails with:validatron_derive
uses proc macros. Maybe this adds the extra dependency causing the issue. The missing libtest shared library could be found inside~/.rustup/toolchains/
.I tried copying
validatron_derive
to a clean workspace and I couldn't reproduce the issue. It turns out the problem comes from our.cargo/config
file:Running all our artifacts with sudo during development was convenient since eBPF needs roots permissions to be loaded, but maybe it's time to find a better solution.
We could remove the runner config and explicitly call sudo. For binaries like
pulsar-exec
this is not an issue since the path is fixed (eg.cargo build && sudo ./target/debug/pulsar-exec
). The problem arises for tests, where the path is automatically generated, making it hard to run it with two commands. Unfortunately, replacing unit tests with integration tests won't change the fact we have a random name, liketarget/debug/deps/integration_test-74139a0d8fe9d447
. One possible workaround would be making the test suite a separate binary. Another solution would be to make atest_suite
binary which calls the individual modules tests, enabling a specific feature flag.Let me know what you think, maybe we can come up with better solution.