Commit graph

44 commits

Author SHA1 Message Date
ppom
3e44568fa4
ipset: Manuel e2e test does pass 2026-02-06 12:00:00 +01:00
ppom
48a67e6525
Extract ipset options from action options so that it's globally merged
Actions don't manage sets anymore.
Set options are merged at each new action,
then Sets are managed by themselves.
2026-01-31 12:00:00 +01:00
ppom
2f7c32aa8c
ipset: Add the add/del option, journal orders & deduplicate them 2026-01-29 12:00:00 +01:00
ppom
cfd16b2bc6
reaction-plugin-ipset: first work session 2026-01-28 12:00:00 +01:00
ppom
1e082086e5
cluster: add tests
- on configuration
- on sending messages to its own cluster
2026-01-19 12:00:00 +01:00
ppom
5a44ae89e9
sleep a bit more to fix time-sensitive test 2025-12-16 12:00:00 +01:00
ppom
f6e03496e1
Fix plugin_cluster test, now passing 🎉 2025-12-07 12:00:00 +01:00
ppom
c9e3a07fde
ignore cluster test for now 2025-12-07 12:00:00 +01:00
ppom
a5d31f6c1a
cluster: First round of fixes and tests after first run
Still not working!
2025-12-07 12:00:00 +01:00
ppom
bc0271b209
Fix test that did not pass when virtual was not previously built
This seems a bit hacky though because
the test needs to have `cargo` in `$PATH`
2025-12-07 12:00:00 +01:00
ppom
ebf906ea51
Better doc and errors 2025-12-07 12:00:00 +01:00
ppom
310d3dbe99
Fix plugin build, one secret key per cluster, more work on cluster init 2025-12-07 12:00:00 +01:00
ppom
58180fe609
fmt, clippy, tests, fix some tests after startup refacto 2025-12-07 12:00:00 +01:00
ppom
124a2827d9
Cluster plugin init
- Remove PersistData utility
- Provide plugins a state directory instead, by starting them inside.
- Store the secret key as a file inside this directory.
- Use iroh's crate for base64 encoding, thus removing one dependency.
- Implement plugin's stream_impl and action_impl functions,
  creating all necessary data structures.
2025-12-07 12:00:00 +01:00
ppom
61fe405b85
Add cluster plugin skeleton 2025-12-07 12:00:00 +01:00
ppom
0c4d19a4d7
plugins are now named
and fixed the virtual test
2025-12-07 12:00:00 +01:00
ppom
a5c563d55f
WIP systemd support
The logic seems to be fine.
Still need to think what security defaults are pertinent.
2025-12-07 12:00:00 +01:00
ppom
7cbf482e4d
plugin improvements
- fix panic of channel(0)
- cleaner plugin interface with one level of Result
- standalone metadata for stream plugins
- new test for plugin virtual
2025-12-07 12:00:00 +01:00
Baptiste Careil
c6e4af96cd
Fix some triggers no longer triggering after being loaded from db 2025-09-19 12:00:00 +02:00
Baptiste Careil
1f734a516d Fix test load_conf_directory
- Fixed concurrency to 1 not to be platform dependent
- Added fields introduced by recent changes
- Used builtin str comparator that produces a diff instead of the eq
  predicate
2025-08-17 18:33:09 +02:00
ppom
ca89c7f72a
Fix filter commands executing before start commands
Now creating the socket file before starting its manager.
So I can launch start commands after its creation, and before creating
the filter managers.
2025-08-08 12:00:00 +02:00
ppom
58f4793308
Fix triggers being forgotten on after actions with on_exit: true
decrement_trigger do not delete triggers anymore when exiting

test still failing because filters start before start commands
2025-08-08 12:00:00 +02:00
ppom
607141f22f
Fix after action commands not being correctly awaited
We were scheduling the action with exec_now, but it spawns a new task
itself, which did not have the ShutdownToken.

Persistance part of the start_stop test doesn't work
because when the after actions are executed, they decrement the trigger,
which is then removed from DB.
So they should not decrement it anymore, just check that it's still
there. Next commit!
2025-08-06 12:00:00 +02:00
ppom
c824583613
Add new failing tests on start / stop sequences.
They fail because reaction don't correctly order stop commands after
2025-08-06 12:00:00 +02:00
ppom
91885e49bd
Ignore new tests that fail for now
FIXME check this later
2025-08-06 12:00:00 +02:00
ppom
eea708883b
Add example config equality test 2025-08-06 12:00:00 +02:00
Baptiste Careil
0337fcab1f
Automate some tests 2025-08-06 12:00:00 +02:00
ppom
6f63f49acd
Add failing test for flushing ipvXonly actions 2025-08-04 12:00:00 +02:00
ppom
270a1a9bdf
Duplicate: Fix tests, more tests 2025-07-14 12:00:00 +02:00
ppom
bba113b6ab
Remove newline at the end of stream lines
Bug introduced by !24 which kept trailing `\n` and fed it to filters.
Thus regexes ending with `$` couldn't match anymore.

Fixes #128
2025-07-07 12:00:00 +02:00
ppom
6a778f3d01
cargo fmt, cargo clippy --all-targets 2025-06-24 12:00:00 +02:00
Baptiste Careil
d12a61c14a Fix #124: discard invalid utf8 sequences from input streams 2025-06-23 19:13:49 +00:00
ppom
4cb69fb0d4
Add test for trigger command 2025-06-23 12:00:00 +02:00
ppom
5bccdb5ba7
Add oneshot option for actions
Fixes #92
2025-06-10 12:00:00 +02:00
ppom
daf1bf3818
Update configuration
- README.md: update minimal example (was outdated since a long time 🤐)
- README.md: link to Security part of the wiki
- README.md: fix OpenBSD broken link
- README.md: add `state_directory` option
- activitywatch & server configs: remove from config directory. only
  available in the wiki.
- heavy-load: move to new bench directory
- test: move to tests directory

Fix #121
2025-05-31 12:00:00 +02:00
Baptiste Careil
cf96fa30f1
Add test directory for reading configuration files from a directory 2025-05-28 12:00:00 +02:00
ppom
859e35e5c3 Speed up tests now that we handle millisecond precision
Previously database cropped to the second precision
Now it keeps millisecond precision and handle millisecond units
2025-02-26 12:00:00 +01:00
ppom
82ab861132 Fix and enhance tests
The tokio task that removes the trigger after the last after-action was
not woken up & cancelled by the cancellation token, but left to die when
tokio quits.

Unfortunately this broke the tests, where tokio is kept from one
reaction launch to another. Those tasks kept a reference to the DB, then
preventing it to close, then preventing a new DB instance from being
opened.

This was difficult to debug due to the tests only checking that reaction
quits with an error, but not testing what kind of error it is.
So they now check that reaction quits with the "normal" error, which is
that all streams finished.

The tokio task is now woken up, like the other sleeping tasks, at
shutdown, and quits doing nothing.

It's not very satisfying because I assume it's a bit costly to wake up a
task, so I'm gonna see how I can improve this.

I may start a new tokio runtime for each subtest.
I may delete this task and move its instructions to the last
after-action.
I may do both.
2025-02-16 12:00:00 +01:00
Baptiste Careil
672f0e9599 Add test config to test delayed actions 2024-12-29 10:20:20 +01:00
Baptiste Careil
68637e35a7 Fix #110: don't show error message on shutdown
The stream_manager is now the sole owner of the child process handle and
is responsible for cleaning it.

The stream_manager expects a shutdown command from the broadcast channel
it receives as parameter and watches it concurrently with the child process
I/O.

When the shutdown command is received, the child process is killed and the
remaining I/O is processed. Then the child process is reaped. Or it is
killed and reaped after EOF is encountered, would the child process exit
before (or at the same time as) the shutdown command is issued.
2024-11-19 14:54:53 +00:00
Baptiste Careil
a3081b0486 Fix #111: Streams now read stderr from started processes 2024-11-11 16:54:35 +01:00
ppom
79677cf327 Restructure code and document it in ARCHITECTURE.md 2024-10-26 12:00:00 +02:00
ppom
40fc6e3380 Fix client-daemon protocol & client output 2024-10-24 12:00:00 +02:00
ppom
3dd97523fd Move new rust codebase to root dir 2024-10-24 12:00:00 +02:00