feat(tests): enhance integration tests for CrowdSec and Coraza, improve error handling and logging

- Updated `coraza_integration_test.go` and `crowdsec_integration_test.go` for better logging and error handling.
- Added `ttlRemainingSeconds` to `CrowdsecHandler` to provide remaining TTL in responses.
- Improved error messages in `ApplyPreset` and `GetCachedPreset` methods for better user guidance.
- Enhanced test coverage for applying presets, including scenarios for cache misses and expired caches.
- Introduced new tests for cache refresh logic and ensured proper rollback behavior during failures.
- Updated QA report with recent testing outcomes and observations.
This commit is contained in:
GitHub Actions
2025-12-11 00:59:53 +00:00
parent cf912f15eb
commit 28ad90d962
17 changed files with 445 additions and 143 deletions
+22
View File
@@ -2,6 +2,28 @@
Note: This report documents a QA audit of the history-rewrite scripts. The scripts and tests live in `scripts/history-rewrite/` and the maintainer-facing plan and checklist are in `docs/plans/history_rewrite.md`.
# QA Report: Backend Verification (Dec 11, 2025)
- **Date:** 2025-12-11
- **QA Agent:** QA_Automation
- **Scope:** Backend regression verification per request (gofmt + full Go tests + targeted CrowdSec apply/pull tests).
## Commands Executed
- `cd backend && gofmt -w .`
- `cd backend && go test ./... -v`
- `cd backend && go test ./internal/crowdsec/... -v`
## Results
- `gofmt` completed without errors.
- `go test ./... -v` **Passed**. All packages succeeded; noisy but expected SQLite "record not found" logs appeared during in-memory test setup. Longest runtime segment was `internal/services` (~28s) due to uptime checks.
- `go test ./internal/crowdsec/... -v` **Passed**. All CrowdSec pull/apply/cache tests green; cache refresh and rollback paths covered.
## Observations
- The full suite emits informational logs (certificate and uptime services) and expected skips for SMTP integration; no assertion failures.
- CrowdSec tests exercised backup rollback, cache-miss repull, and apply-from-cache flows; no regressions observed.
**Status:** ✅ PASS — Backend formatting and regression tests completed successfully.
- **Date**: 2025-12-09
- **Author**: QA_Security (Automated checks)