(t *testing.T)
| 544 | } |
| 545 | |
| 546 | func TestFileStorage_CleanAll(t *testing.T) { |
| 547 | if !testutils.IsSingleTesting() { |
| 548 | return |
| 549 | } |
| 550 | |
| 551 | var storage = NewFileStorage(&serverconfigs.HTTPCachePolicy{ |
| 552 | Id: 1, |
| 553 | IsOn: true, |
| 554 | Options: map[string]interface{}{ |
| 555 | "dir": Tea.Root + "/caches", |
| 556 | }, |
| 557 | }) |
| 558 | |
| 559 | defer storage.Stop() |
| 560 | |
| 561 | err := storage.Init() |
| 562 | if err != nil { |
| 563 | t.Fatal(err) |
| 564 | } |
| 565 | |
| 566 | before := time.Now() |
| 567 | defer func() { |
| 568 | t.Log(time.Since(before).Seconds()*1000, "ms") |
| 569 | }() |
| 570 | |
| 571 | c, _ := storage.list.Count() |
| 572 | t.Log("before:", c) |
| 573 | |
| 574 | err = storage.CleanAll() |
| 575 | if err != nil { |
| 576 | t.Fatal(err) |
| 577 | } |
| 578 | |
| 579 | c, _ = storage.list.Count() |
| 580 | t.Log("after:", c) |
| 581 | t.Log("ok") |
| 582 | } |
| 583 | |
| 584 | func TestFileStorage_Stop(t *testing.T) { |
| 585 | if !testutils.IsSingleTesting() { |
nothing calls this directly
no test coverage detected