(t *testing.T)
| 225 | } |
| 226 | |
| 227 | func TestBenchmarkDropAllRemote(t *testing.T) { |
| 228 | if testing.Short() || os.Getenv("LONG_TEST") == "" { |
| 229 | t.Skip("slow test") |
| 230 | } |
| 231 | |
| 232 | db, err := Open(t.TempDir()) |
| 233 | if err != nil { |
| 234 | t.Fatal(err) |
| 235 | } |
| 236 | t.Cleanup(func() { |
| 237 | if err := db.Close(); err != nil { |
| 238 | t.Fatal(err) |
| 239 | } |
| 240 | }) |
| 241 | |
| 242 | fs := make([]protocol.FileInfo, 1000) |
| 243 | seq := 0 |
| 244 | for { |
| 245 | local, err := db.CountLocal(folderID, protocol.LocalDeviceID) |
| 246 | if err != nil { |
| 247 | t.Fatal(err) |
| 248 | } |
| 249 | if local.Files >= 15_000 { |
| 250 | break |
| 251 | } |
| 252 | for i := range fs { |
| 253 | seq++ |
| 254 | fs[i] = genFile(rand.String(24), 64, seq) |
| 255 | } |
| 256 | if err := db.Update(folderID, protocol.DeviceID{42}, fs); err != nil { |
| 257 | t.Fatal(err) |
| 258 | } |
| 259 | if err := db.Update(folderID, protocol.LocalDeviceID, fs); err != nil { |
| 260 | t.Fatal(err) |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | t0 := time.Now() |
| 265 | if err := db.DropAllFiles(folderID, protocol.DeviceID{42}); err != nil { |
| 266 | t.Fatal(err) |
| 267 | } |
| 268 | d := time.Since(t0) |
| 269 | t.Log("drop all took", d) |
| 270 | } |
| 271 | |
| 272 | func TestBenchmarkSizeManyFilesRemotes(t *testing.T) { |
| 273 | // Reports the database size for a setup with many files and many remote |
nothing calls this directly
no test coverage detected