MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestTask_Cleanup_KeepsActive

Function TestTask_Cleanup_KeepsActive

internal/bridge/taskmanager_test.go:324–340  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

322}
323
324func TestTask_Cleanup_KeepsActive(t *testing.T) {
325 tm := NewTaskManager()
326
327 task := tm.Create("sess-1", 1, "exec")
328 tm.BindCommand("sess-1", 1, "cmd_001")
329
330 // Running task should not be cleaned up even if old.
331 task.mu.Lock()
332 task.UpdatedAt = time.Now().Add(-10 * time.Minute)
333 task.mu.Unlock()
334
335 tm.Cleanup(5 * time.Minute)
336
337 if tm.Get("sess-1", 1) == nil {
338 t.Error("running task should NOT be cleaned up")
339 }
340}
341
342func TestTask_Cleanup_KeepsRecentCompleted(t *testing.T) {
343 tm := NewTaskManager()

Callers

nothing calls this directly

Calls 6

CreateMethod · 0.95
BindCommandMethod · 0.95
CleanupMethod · 0.95
GetMethod · 0.95
NewTaskManagerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected