(t *testing.T)
| 179 | } |
| 180 | |
| 181 | func TestSQLiteStore_DeleteAll(t *testing.T) { |
| 182 | db := setupTestDB(t) |
| 183 | store := storage.NewSQLiteStore(db) |
| 184 | ctx := context.Background() |
| 185 | |
| 186 | for _, ev := range []event.Event{ |
| 187 | makeEvent("d1", "sentry", "proj-a"), |
| 188 | makeEvent("d2", "ray", "proj-a"), |
| 189 | makeEvent("d3", "sentry", "proj-b"), |
| 190 | } { |
| 191 | store.Store(ctx, ev) |
| 192 | } |
| 193 | |
| 194 | t.Run("delete by UUIDs", func(t *testing.T) { |
| 195 | if err := store.DeleteAll(ctx, event.DeleteOptions{UUIDs: []string{"d1"}}); err != nil { |
| 196 | t.Fatal(err) |
| 197 | } |
| 198 | all, _ := store.FindAll(ctx, event.FindOptions{}) |
| 199 | if len(all) != 2 { |
| 200 | t.Errorf("len = %d, want 2", len(all)) |
| 201 | } |
| 202 | }) |
| 203 | |
| 204 | t.Run("delete by type", func(t *testing.T) { |
| 205 | if err := store.DeleteAll(ctx, event.DeleteOptions{Type: "sentry"}); err != nil { |
| 206 | t.Fatal(err) |
| 207 | } |
| 208 | all, _ := store.FindAll(ctx, event.FindOptions{}) |
| 209 | if len(all) != 1 { |
| 210 | t.Errorf("len = %d, want 1", len(all)) |
| 211 | } |
| 212 | }) |
| 213 | |
| 214 | t.Run("delete all", func(t *testing.T) { |
| 215 | if err := store.DeleteAll(ctx, event.DeleteOptions{}); err != nil { |
| 216 | t.Fatal(err) |
| 217 | } |
| 218 | all, _ := store.FindAll(ctx, event.FindOptions{}) |
| 219 | if len(all) != 0 { |
| 220 | t.Errorf("len = %d, want 0", len(all)) |
| 221 | } |
| 222 | }) |
| 223 | } |
| 224 | |
| 225 | func TestSQLiteStore_Pin_Unpin(t *testing.T) { |
| 226 | db := setupTestDB(t) |
nothing calls this directly
no test coverage detected