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

Function TestSQLiteStore_Store_and_FindByUUID

internal/storage/sqlite_test.go:40–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestSQLiteStore_Store_and_FindByUUID(t *testing.T) {
41 db := setupTestDB(t)
42 store := storage.NewSQLiteStore(db)
43 ctx := context.Background()
44
45 ev := makeEvent("uuid-1", "sentry", "default")
46 if err := store.Store(ctx, ev); err != nil {
47 t.Fatalf("Store: %v", err)
48 }
49
50 found, err := store.FindByUUID(ctx, "uuid-1")
51 if err != nil {
52 t.Fatalf("FindByUUID: %v", err)
53 }
54 if found == nil {
55 t.Fatal("expected event, got nil")
56 }
57 if found.UUID != "uuid-1" {
58 t.Errorf("UUID = %q, want %q", found.UUID, "uuid-1")
59 }
60 if found.Type != "sentry" {
61 t.Errorf("Type = %q, want %q", found.Type, "sentry")
62 }
63 if found.Project != "default" {
64 t.Errorf("Project = %q, want %q", found.Project, "default")
65 }
66}
67
68func TestSQLiteStore_FindByUUID_NotFound(t *testing.T) {
69 db := setupTestDB(t)

Callers

nothing calls this directly

Calls 5

StoreMethod · 0.95
FindByUUIDMethod · 0.95
NewSQLiteStoreFunction · 0.92
makeEventFunction · 0.85
setupTestDBFunction · 0.70

Tested by

no test coverage detected