Watch
1
0
Fork
You've already forked RedFlag
0

test: guard test learns the bgRunner.Every pattern

Ticker consolidation moved refresh_token_cleanup into the taskrunner;
the source-grep guard only knew go func/ticker.
This commit is contained in:
Fimeg 2026-06-11 20:39:32 -04:00
commit 1af5a9a184

View file

@ -27,14 +27,16 @@ func TestNoBackgroundRefreshTokenCleanup(t *testing.T) {
return
}
// Check it's in a goroutine context
// Check it's in a background context: raw goroutine/ticker, or a
// managed taskrunner registration (bgRunner.Every).
idx := strings.Index(src, "cleanupexpiredtokens")
start := idx - 300
if start < 0 {
start = 0
}
context := src[start:idx]
if !strings.Contains(context, "go func") && !strings.Contains(context, "ticker") {
if !strings.Contains(context, "go func") && !strings.Contains(context, "ticker") &&
!strings.Contains(context, ".every(") {
t.Error("[ERROR] [server] [database] CleanupExpiredTokens exists but not in background context")
return
}