package client import ( "strings" "testing" "time" ) func TestBofExecuteReturnsExplicitSafetyError(t *testing.T) { c := newTestClient(t) done := make(chan struct { action string success bool message string }, 1) c.commandResultHook = func(action string, success bool, message string) { done <- struct { action string success bool message string }{action, success, message} } c.handleCommand("bof_execute", 0, "", "", "", "") select { case r := <-done: if r.action != "bof_execute" { t.Fatalf("action = %q, want bof_execute", r.action) } if r.success { t.Fatal("bof_execute must fail — in-memory BOF execution is disabled") } msg := strings.ToLower(r.message) if !strings.Contains(msg, "disabled") && !strings.Contains(msg, "not implemented") { t.Fatalf("unexpected error message: %q", r.message) } case <-time.After(2 * time.Second): t.Fatal("timeout waiting for bof_execute command_result hook") } }