chore: clean .gitignore cache

This commit is contained in:
GitHub Actions
2026-01-26 19:21:33 +00:00
parent 1b1b3a70b1
commit e5f0fec5db
1483 changed files with 0 additions and 472793 deletions

View File

@@ -1,38 +0,0 @@
//go:build integration
// +build integration
package integration
import (
"context"
"os/exec"
"strings"
"testing"
"time"
)
// TestCerberusIntegration runs the scripts/cerberus_integration.sh
// to verify all security features work together without conflicts.
func TestCerberusIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
defer cancel()
cmd := exec.CommandContext(ctx, "bash", "./scripts/cerberus_integration.sh")
cmd.Dir = "../.."
out, err := cmd.CombinedOutput()
t.Logf("cerberus_integration script output:\n%s", string(out))
if err != nil {
t.Fatalf("cerberus integration failed: %v", err)
}
if !strings.Contains(string(out), "ALL CERBERUS INTEGRATION TESTS PASSED") {
t.Fatalf("unexpected script output, expected pass assertion not found")
}
}

View File

@@ -1,37 +0,0 @@
//go:build integration
// +build integration
package integration
import (
"context"
"os/exec"
"strings"
"testing"
"time"
)
// TestCorazaIntegration runs the scripts/coraza_integration.sh and ensures it completes successfully.
// This test requires Docker and docker compose access locally; it is gated behind build tag `integration`.
func TestCorazaIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Parallel()
// Ensure the script exists
cmd := exec.CommandContext(context.Background(), "bash", "./scripts/coraza_integration.sh")
// set a timeout in case something hangs
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
cmd = exec.CommandContext(ctx, "bash", "./scripts/coraza_integration.sh")
out, err := cmd.CombinedOutput()
t.Logf("coraza_integration script output:\n%s", string(out))
if err != nil {
t.Fatalf("coraza integration failed: %v", err)
}
if !strings.Contains(string(out), "Coraza WAF blocked payload as expected") {
t.Fatalf("unexpected script output, expected blocking assertion not found")
}
}

View File

@@ -1,104 +0,0 @@
//go:build integration
// +build integration
package integration
import (
"context"
"os/exec"
"strings"
"testing"
"time"
)
// TestCrowdsecStartup runs the scripts/crowdsec_startup_test.sh and ensures
// CrowdSec can start successfully without the fatal "no datasource enabled" error.
// This is a focused test for verifying basic CrowdSec initialization.
//
// The test verifies:
// - No "no datasource enabled" fatal error
// - LAPI health endpoint responds (if CrowdSec is installed)
// - Acquisition config exists with datasource definition
// - Parsers and scenarios are installed (if cscli is available)
//
// This test requires Docker access and is gated behind build tag `integration`.
func TestCrowdsecStartup(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Parallel()
// Set a timeout for the entire test
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
// Run the startup test script from the repo root
cmd := exec.CommandContext(ctx, "bash", "../scripts/crowdsec_startup_test.sh")
cmd.Dir = ".." // Run from repo root
out, err := cmd.CombinedOutput()
t.Logf("crowdsec_startup_test script output:\n%s", string(out))
// Check for the specific fatal error that indicates CrowdSec is broken
if strings.Contains(string(out), "no datasource enabled") {
t.Fatal("CRITICAL: CrowdSec failed with 'no datasource enabled' - acquis.yaml is missing or empty")
}
if err != nil {
t.Fatalf("crowdsec startup test failed: %v", err)
}
// Verify success message is present
if !strings.Contains(string(out), "ALL CROWDSEC STARTUP TESTS PASSED") {
t.Fatalf("unexpected script output: final success message not found")
}
}
// TestCrowdsecDecisionsIntegration runs the scripts/crowdsec_decision_integration.sh and ensures it completes successfully.
// This test requires Docker access locally; it is gated behind build tag `integration`.
//
// The test verifies:
// - CrowdSec status endpoint works correctly
// - Decisions list endpoint returns valid response
// - Ban IP operation works (or gracefully handles missing cscli)
// - Unban IP operation works (or gracefully handles missing cscli)
// - Export endpoint returns valid response
// - LAPI health endpoint returns valid response
//
// Note: CrowdSec binary may not be available in the test container.
// Tests gracefully handle this scenario and skip operations requiring cscli.
func TestCrowdsecDecisionsIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Parallel()
// Set a timeout for the entire test
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
// Run the integration script from the repo root
cmd := exec.CommandContext(ctx, "bash", "../scripts/crowdsec_decision_integration.sh")
cmd.Dir = ".." // Run from repo root
out, err := cmd.CombinedOutput()
t.Logf("crowdsec_decision_integration script output:\n%s", string(out))
// Check for the specific fatal error that indicates CrowdSec is broken
if strings.Contains(string(out), "no datasource enabled") {
t.Fatal("CRITICAL: CrowdSec failed with 'no datasource enabled' - acquis.yaml is missing or empty")
}
if err != nil {
t.Fatalf("crowdsec decision integration failed: %v", err)
}
// Verify key assertions are present in output
if !strings.Contains(string(out), "Passed:") {
t.Fatalf("unexpected script output: pass count not found")
}
if !strings.Contains(string(out), "ALL CROWDSEC DECISION TESTS PASSED") {
t.Fatalf("unexpected script output: final success message not found")
}
}

View File

@@ -1,37 +0,0 @@
//go:build integration
// +build integration
package integration
import (
"context"
"os/exec"
"strings"
"testing"
"time"
)
// TestCrowdsecIntegration runs scripts/crowdsec_integration.sh and ensures it completes successfully.
func TestCrowdsecIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Parallel()
cmd := exec.CommandContext(context.Background(), "bash", "./scripts/crowdsec_integration.sh")
// Ensure script runs from repo root so relative paths in scripts work reliably
cmd.Dir = "../../"
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
defer cancel()
cmd = exec.CommandContext(ctx, "bash", "./scripts/crowdsec_integration.sh")
cmd.Dir = "../../"
out, err := cmd.CombinedOutput()
t.Logf("crowdsec_integration script output:\n%s", string(out))
if err != nil {
t.Fatalf("crowdsec integration failed: %v", err)
}
if !strings.Contains(string(out), "Apply response: ") {
t.Fatalf("unexpected script output, expected Apply response in output")
}
}

View File

@@ -1,5 +0,0 @@
// Package integration contains end-to-end integration tests.
//
// These tests are gated behind the "integration" build tag and require
// a full environment (Docker, etc.) to run.
package integration

View File

@@ -1,51 +0,0 @@
//go:build integration
// +build integration
package integration
import (
"context"
"os/exec"
"strings"
"testing"
"time"
)
// TestRateLimitIntegration runs the scripts/rate_limit_integration.sh and ensures it completes successfully.
// This test requires Docker and docker compose access locally; it is gated behind build tag `integration`.
//
// The test verifies:
// - Rate limiting is correctly applied to proxy hosts
// - Requests within the limit return HTTP 200
// - Requests exceeding the limit return HTTP 429
// - Rate limit window resets correctly
func TestRateLimitIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Parallel()
// Set a timeout for the entire test (rate limit tests need time for window resets)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
// Run the integration script from the repo root
cmd := exec.CommandContext(ctx, "bash", "../scripts/rate_limit_integration.sh")
cmd.Dir = ".." // Run from repo root
out, err := cmd.CombinedOutput()
t.Logf("rate_limit_integration script output:\n%s", string(out))
if err != nil {
t.Fatalf("rate limit integration failed: %v", err)
}
// Verify key assertions are present in output
if !strings.Contains(string(out), "Rate limit enforcement succeeded") {
t.Fatalf("unexpected script output: rate limit enforcement assertion not found")
}
if !strings.Contains(string(out), "ALL RATE LIMIT TESTS PASSED") {
t.Fatalf("unexpected script output: final success message not found")
}
}

View File

@@ -1,37 +0,0 @@
//go:build integration
// +build integration
package integration
import (
"context"
"os/exec"
"strings"
"testing"
"time"
)
// TestWAFIntegration runs the scripts/waf_integration.sh and ensures it completes successfully.
func TestWAFIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
cmd := exec.CommandContext(ctx, "bash", "./scripts/waf_integration.sh")
cmd.Dir = "../.."
out, err := cmd.CombinedOutput()
t.Logf("waf_integration script output:\n%s", string(out))
if err != nil {
t.Fatalf("waf integration failed: %v", err)
}
if !strings.Contains(string(out), "ALL WAF TESTS PASSED") {
t.Fatalf("unexpected script output, expected pass assertion not found")
}
}