- Updated the HandleDelete function to allow delete events to be stored even if no valid targets are found, enhancing flexibility in event management. - Improved logging to provide clearer insights when no deletions are processed, ensuring that issues are logged without blocking event acceptance. - Refactored SHA256 validation tests and adjusted expected values to ensure accuracy in hash comparisons. - Enhanced various test cases to improve coverage and reliability across the application.
31 lines
606 B
Go
31 lines
606 B
Go
package policy
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"testing"
|
|
|
|
"lol.mleku.dev"
|
|
"lol.mleku.dev/log"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
// Disable all logging during tests unless explicitly enabled
|
|
if os.Getenv("TEST_LOG") == "" {
|
|
// Set log level to Off to suppress all logs
|
|
lol.SetLogLevel("off")
|
|
// Also redirect output to discard
|
|
lol.Writer = io.Discard
|
|
// Disable all log printers
|
|
log.T = lol.GetNullPrinter()
|
|
log.D = lol.GetNullPrinter()
|
|
log.I = lol.GetNullPrinter()
|
|
log.W = lol.GetNullPrinter()
|
|
log.E = lol.GetNullPrinter()
|
|
log.F = lol.GetNullPrinter()
|
|
}
|
|
|
|
// Run tests
|
|
os.Exit(m.Run())
|
|
}
|