test: add integration tests for HTTP server, webhook, and executor #194

Merged
fuzzy merged 2 commits from test/add-integration-tests into main 2026-07-06 10:21:46 +00:00
Owner

What

Add integration tests in test/integration_test.go covering the full pipeline:

  • HTTP server health endpoint via httptest.Server (#117)
  • Webhook endpoint with valid JSON payloads (#118)
  • Signature verification rejecting unsigned requests (#117)
  • Config loading and validation end-to-end (#118)
  • Command execution writing output to temp files (#119)
  • Rule matching with conditions and dot notation (#119)
  • Concurrent request handling — 10 simultaneous requests (#120)

Why

Verify that components work together correctly across the webhook → rules → executor pipeline.

Testing

  • Unit tests pass — 7 integration tests
  • Integration tests pass — tests themselves are integration tests
  • Manual testing performed — go test ./test/ -v and pre-commit pass
  • New tests added for new functionality — this IS the new tests

Breaking Changes

None.

Notes

  • Integration test directory follows Go conventions (/test at top level)
  • Uses t.TempDir() for clean isolation between tests
  • Command execution test writes to temp file and verifies output
  • Concurrent test validates race-free request handling

Closes #121
Closes #117
Closes #118
Closes #119
Closes #120

## What Add integration tests in `test/integration_test.go` covering the full pipeline: - HTTP server health endpoint via `httptest.Server` (#117) - Webhook endpoint with valid JSON payloads (#118) - Signature verification rejecting unsigned requests (#117) - Config loading and validation end-to-end (#118) - Command execution writing output to temp files (#119) - Rule matching with conditions and dot notation (#119) - Concurrent request handling — 10 simultaneous requests (#120) ## Why Verify that components work together correctly across the webhook → rules → executor pipeline. ## Testing - [x] Unit tests pass — 7 integration tests - [x] Integration tests pass — tests themselves are integration tests - [x] Manual testing performed — `go test ./test/ -v` and pre-commit pass - [x] New tests added for new functionality — this IS the new tests ## Breaking Changes None. ## Notes - Integration test directory follows Go conventions (`/test` at top level) - Uses `t.TempDir()` for clean isolation between tests - Command execution test writes to temp file and verifies output - Concurrent test validates race-free request handling Closes #121 Closes #117 Closes #118 Closes #119 Closes #120
Covers:
- HTTP server health endpoint
- Webhook endpoint with valid payloads
- Signature verification rejection
- Config loading and validation end-to-end
- Command execution via executor with file output verification
- Rule matching with conditions and dot notation
- Concurrent request handling (10 concurrent requests)

Closes #117
Closes #118
Closes #119
Closes #120
docs: mark Write integration tests tasks as complete
All checks were successful
CI / Test (pull_request) Successful in 1m40s
CI / Lint (golangci-lint) (pull_request) Successful in 1m44s
CI / Pre-commit Hooks (pull_request) Successful in 4m53s
CI / Lint (golangci-lint) (push) Successful in 1m38s
CI / Pre-commit Hooks (push) Successful in 2m41s
CI / Test (push) Successful in 5m42s
ed3b557921
Closes #121
the.auditor left a comment

Review

Solid integration test suite. All 7 tests pass with race detector. Lint and vet clean.

Tests:

  1. TestHTTPServerHealthEndpoint — GET /health → 200
  2. TestHTTPServerWebhookEndpoint — POST valid JSON → 200
  3. TestHTTPServerSignatureVerification — POST without signature → 401
  4. TestConfigLoadAndValidate — config load + field verification
  5. TestCommandExecution — shell command writing to temp file, output verified
  6. TestRuleMatching — rule matching with conditions + dot notation
  7. TestConcurrentRequests — 10 goroutines, sync.WaitGroup, buffered error channel

Design: package test at top-level /test directory per Go conventions. writeTempConfig helper with t.TempDir(). File-based verification for command execution.

No blocking issues.

APPROVED

## Review Solid integration test suite. All 7 tests pass with race detector. Lint and vet clean. **Tests**: 1. `TestHTTPServerHealthEndpoint` — GET /health → 200 2. `TestHTTPServerWebhookEndpoint` — POST valid JSON → 200 3. `TestHTTPServerSignatureVerification` — POST without signature → 401 4. `TestConfigLoadAndValidate` — config load + field verification 5. `TestCommandExecution` — shell command writing to temp file, output verified 6. `TestRuleMatching` — rule matching with conditions + dot notation 7. `TestConcurrentRequests` — 10 goroutines, sync.WaitGroup, buffered error channel **Design**: `package test` at top-level `/test` directory per Go conventions. `writeTempConfig` helper with `t.TempDir()`. File-based verification for command execution. **No blocking issues.** **APPROVED**
fuzzy merged commit ed3b557921 into main 2026-07-06 10:21:46 +00:00
fuzzy deleted branch test/add-integration-tests 2026-07-06 10:21:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/ttheart!194
No description provided.