- Add gotestsum for real-time test progress visibility - Parallelize 174 tests across 14 files for faster execution - Add -short mode support skipping 21 heavy integration tests - Create testutil/db.go helper for future transaction rollbacks - Fix data race in notification_service_test.go - Fix 4 CrowdSec LAPI test failures with permissive validator Performance improvements: - Tests now run in parallel (174 tests with t.Parallel()) - Quick feedback loop via -short mode - Zero race conditions detected - Coverage maintained at 87.7% Closes test optimization initiative
39 lines
921 B
Go
39 lines
921 B
Go
//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")
|
|
}
|
|
}
|