完善配置审计与数据库迁移安全链路
This commit is contained in:
1 parent
84440d8761
commit
3af1fc4147
117 files changed
+4703
-1110
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -84,3 +85,25 @@ func TestCleanupStateInsertQueryUsesPostgresPlaceholders(t *testing.T) {
|
||||
t.Fatalf("postgres cleanup query contains empty placeholders: %q", query)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOperationalCleanupRunnerStopIsIdempotentAndConcurrentSafe(t *testing.T) {
|
||||
engine := newCleanupEngine(t)
|
||||
defer engine.Close()
|
||||
store, err := NewEventStore(engine)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
runner := NewOperationalCleanupRunner(store)
|
||||
runner.Start()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < 8; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
runner.Stop()
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
runner.Stop()
|
||||
}
|
||||
Reference in new issue
Block a user