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

Function TestTask_LookupByCommand

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

Source from the content-addressed store, hash-verified

104}
105
106func TestTask_LookupByCommand(t *testing.T) {
107 tm := NewTaskManager()
108 tm.Create("sess-1", 1, "upload")
109 tm.Create("sess-1", 2, "exec")
110
111 tm.BindCommand("sess-1", 1, "cmd_upload_1")
112 tm.BindCommand("sess-1", 1, "cmd_upload_2")
113 tm.BindCommand("sess-1", 2, "cmd_exec_1")
114
115 if task := tm.LookupByCommand("cmd_upload_1"); task == nil || task.ID != 1 {
116 t.Error("should find upload task for cmd_upload_1")
117 }
118 if task := tm.LookupByCommand("cmd_exec_1"); task == nil || task.ID != 2 {
119 t.Error("should find exec task for cmd_exec_1")
120 }
121 if tm.LookupByCommand("nonexistent") != nil {
122 t.Error("should return nil for unknown command")
123 }
124}
125
126func TestTask_AwaitResult(t *testing.T) {
127 tm := NewTaskManager()

Callers

nothing calls this directly

Calls 5

CreateMethod · 0.95
BindCommandMethod · 0.95
LookupByCommandMethod · 0.95
NewTaskManagerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected