Skip to content

test: integration/E2E tests for dynamic pipelines daemon#90

Merged
mostafa merged 1 commit into
mainfrom
test/dynamic-pipelines-e2e
May 7, 2026
Merged

test: integration/E2E tests for dynamic pipelines daemon#90
mostafa merged 1 commit into
mainfrom
test/dynamic-pipelines-e2e

Conversation

@mostafa
Copy link
Copy Markdown
Member

@mostafa mostafa commented May 7, 2026

Summary

  • Adds 16 end-to-end tests in crates/rsigma-cli/tests/cli_daemon_dynamic.rs covering the full dynamic pipeline lifecycle: source resolution at startup, detection with dynamically-resolved vars, source refresh on file change, reload preservation, error policy enforcement (use_cached, fail), API-triggered re-resolution, include expansion for dynamic transformations, Prometheus metrics, cache invalidation, and CLI commands (resolve, validate --resolve-sources).
  • Fixes a subtle SIGPIPE issue in the test harness: the original DaemonProcess::spawn dropped the stderr pipe reader after startup detection, causing the daemon's reload handler to fail silently when trying to log. The new implementation uses a background reader thread to keep the pipe alive.

Test plan

  • All 16 new E2E tests pass (cargo test -p rsigma --test cli_daemon_dynamic -- --test-threads=1)
  • Existing daemon HTTP tests still pass (cargo test -p rsigma --test cli_daemon_http)
  • Full workspace test suite passes (cargo test --workspace)
  • Clippy clean (cargo clippy --workspace --all-targets --all-features -- -D warnings)
  • Formatting clean (cargo fmt --all -- --check)

16 end-to-end tests covering the full dynamic pipeline lifecycle:
- Source resolution at startup with var expansion and detection
- No false positives with non-matching events
- Reload preserves dynamic detection
- Source file change triggers updated detection after reload
- Error policy use_cached serves stale data when source disappears
- Required source with on_error:fail causes daemon exit
- API /sources/resolve triggers re-resolution
- /status includes dynamic_sources summary
- Prometheus metrics include source resolution counters
- DELETE /sources/cache/{id} invalidates cache
- GET /sources returns source list
- Include expansion injects transformations from source
- CLI resolve command and --dry-run flag
- CLI validate --resolve-sources for reachable/unreachable sources

Root cause fix: DaemonProcess stderr handling now uses a reader
thread to keep the pipe alive, preventing SIGPIPE from disrupting
the daemon's reload handler during source re-resolution.
@mostafa mostafa merged commit 3e2bee1 into main May 7, 2026
10 checks passed
@mostafa mostafa deleted the test/dynamic-pipelines-e2e branch May 7, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant