MCPcopy Create free account
hub / github.com/buggregator/server / TestHandlerWithDB

Function TestHandlerWithDB

modules/sentry/storage_test.go:478–507  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

476}
477
478func TestHandlerWithDB(t *testing.T) {
479 db := setupTestDB(t)
480 h := &handler{db: db}
481
482 body := []byte(`{"event_id":"full-test"}
483{"type":"event","length":0}
484{"event_id":"full-test","level":"warning","message":"test message","exception":{"values":[{"type":"TestException","value":"test"}]}}`)
485
486 inc, err := h.handleEnvelope(body, "testproject")
487 if err != nil {
488 t.Fatal(err)
489 }
490
491 if inc.UUID != "full-test" {
492 t.Errorf("UUID = %q, want 'full-test'", inc.UUID)
493 }
494
495 // Verify structured data was stored.
496 var count int
497 db.QueryRow(`SELECT COUNT(*) FROM sentry_error_events`).Scan(&count)
498 if count != 1 {
499 t.Errorf("error events = %d, want 1", count)
500 }
501
502 var excCount int
503 db.QueryRow(`SELECT COUNT(*) FROM sentry_exceptions`).Scan(&excCount)
504 if excCount != 1 {
505 t.Errorf("exceptions = %d, want 1", excCount)
506 }
507}

Callers

nothing calls this directly

Calls 3

handleEnvelopeMethod · 0.95
ScanMethod · 0.80
setupTestDBFunction · 0.70

Tested by

no test coverage detected