Problem
integration/handler.go contains ~90 lines that replicate Gadget's internal event dispatch logic so handlers can be tested without a database or HTTP server:
// integration/handler.go
func TestHandler(r router.Router, routes []router.ChannelMessageRoute, ...) (int, error) {
// verify signature, parse event, match route, execute handler synchronously
}
This is fragile — if Gadget's dispatch logic changes, this test helper silently diverges. It also has to execute handlers synchronously (Gadget uses async goroutines), adding another behavioral difference.
What changes
Replace integration/handler.go with Gadget's official test utilities:
// Before: custom 90-line test dispatcher
result, err := integration.TestHandler(r, routes, body, header)
// After: Gadget-provided test dispatcher
dispatcher := gadgettest.NewDispatcher(gadgettest.WithRoutes(routes...))
err := dispatcher.DispatchMessage(event)
Blocked by
Files affected
integration/handler.go — remove entirely
gadgets/hallmonitor/spam_feed_test.go — update to use Gadget test utilities (if integration-level tests use the dispatcher)
Problem
integration/handler.gocontains ~90 lines that replicate Gadget's internal event dispatch logic so handlers can be tested without a database or HTTP server:This is fragile — if Gadget's dispatch logic changes, this test helper silently diverges. It also has to execute handlers synchronously (Gadget uses async goroutines), adding another behavioral difference.
What changes
Replace
integration/handler.gowith Gadget's official test utilities:Blocked by
Files affected
integration/handler.go— remove entirelygadgets/hallmonitor/spam_feed_test.go— update to use Gadget test utilities (if integration-level tests use the dispatcher)