feat: add integration tests for CrowdSec preset pull and apply

- Introduced `crowdsec_integration_test.go` to validate the integration of the CrowdSec preset pull and apply functionality.
- Updated `RealCommandExecutor` to return combined output for command execution.
- Enhanced `CrowdsecHandler` to map errors to appropriate HTTP status codes, including handling timeouts.
- Added tests for timeout scenarios in `crowdsec_presets_handler_test.go`.
- Improved `HubService` to support configurable pull and apply timeouts via environment variables.
- Implemented fallback logic for fetching hub index from a default URL if the primary fails.
- Updated documentation to reflect changes in preset handling and cscli availability.
- Refactored frontend tests to utilize a new test query client for better state management.
- Added a new integration script `crowdsec_integration.sh` for automated testing of the CrowdSec integration.
This commit is contained in:
GitHub Actions
2025-12-09 00:23:10 +00:00
parent 0acb46bc86
commit a3237fe32c
16 changed files with 412 additions and 56 deletions
@@ -0,0 +1,18 @@
import { QueryClient, QueryKey } from '@tanstack/react-query'
interface InitialDataEntry {
key: QueryKey
data: unknown
}
export function createTestQueryClient(initialData: InitialDataEntry[] = []) {
const client = new QueryClient({
defaultOptions: {
queries: { retry: false, gcTime: Infinity },
mutations: { retry: false },
},
})
initialData.forEach(({ key, data }) => client.setQueryData(key, data))
return client
}