agent-watcher/cmd
bob-boat e7d4ea036a Collector milestone 5: end-to-end integration tests
cmd/agent-watcher/main_test.go builds the real binary in TestMain, then
launches it twice with temp configs to exercise the full path:

TestEndToEnd_BothSourcesEmitToInbox
  - drops a *.json file via tmp+rename (mirrors Syncthing semantics)
  - POSTs a webhook with template variables ({{ .repo }}, {{ .actor }})
  - POSTs a urgent alert with empty body and fixed-string template
  - asserts 3 JSONL lines land in bob.inbox with exact shape
  - confirms each event's source field tracks origin
    ("drop-folder:drop1.json", "webhook:/forgejo/push")
  - hits /health and verifies emitted=2 (one webhook didn't 200, that
    counter only counts successful emits)

TestEndToEnd_GracefulShutdown
  - SIGTERM after listener up
  - asserts process exits within 3s

Total: 43 tests across 5 packages, all passing. Real binary verified
end-to-end on Linux/amd64.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 16:23:34 -04:00
..
agent-watcher Collector milestone 5: end-to-end integration tests 2026-05-06 16:23:34 -04:00