mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 03:17:50 +00:00
don't delete test fragment data (part of repo)
This commit is contained in:
parent
897221a24e
commit
0a8bd6548b
1 changed files with 16 additions and 2 deletions
|
|
@ -1142,7 +1142,7 @@ func BenchmarkFragment_Blocks(b *testing.B) {
|
|||
if err := f.Open(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
defer f.Clean(b)
|
||||
defer f.CleanKeep(b)
|
||||
|
||||
// Reset timer and execute benchmark.
|
||||
b.ResetTimer()
|
||||
|
|
@ -1671,7 +1671,7 @@ func BenchmarkFragment_Snapshot(b *testing.B) {
|
|||
if err := f.Open(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
defer f.Clean(b)
|
||||
defer f.CleanKeep(b)
|
||||
b.ResetTimer()
|
||||
|
||||
// Reset timer and execute benchmark.
|
||||
|
|
@ -2030,6 +2030,20 @@ func (f *fragment) Clean(t testing.TB) {
|
|||
}
|
||||
}
|
||||
|
||||
// CleanKeep is just like Clean(), but it doesn't remove the
|
||||
// fragment file (note that it DOES remove the cache file).
|
||||
func (f *fragment) CleanKeep(t testing.TB) {
|
||||
errc := f.Close()
|
||||
errp := os.Remove(f.cachePath())
|
||||
if errc != nil {
|
||||
t.Fatal("closing fragment: ", errc, errp)
|
||||
}
|
||||
// not all fragments have cache files
|
||||
if errp != nil && !os.IsNotExist(errp) {
|
||||
t.Fatalf("cleaning up fragment cache: %v", errp)
|
||||
}
|
||||
}
|
||||
|
||||
// mustOpenFragment returns a new instance of Fragment with a temporary path.
|
||||
func mustOpenFragment(index, field, view string, shard uint64, cacheType string) *fragment {
|
||||
file, err := ioutil.TempFile(TempDir, "pilosa-fragment-")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue