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:
parent
6cec9aa8ac
commit
1af5a9a184
1 changed files with 4 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue