VictoriaMetrics/lib/storage/table_test.go

33 lines
582 B
Go
Raw Normal View History

2019-05-22 21:16:55 +00:00
package storage
import (
"os"
"testing"
)
func TestTableOpenClose(t *testing.T) {
const path = "TestTableOpenClose"
const retentionMsecs = 123 * msecsPerMonth
2019-05-22 21:16:55 +00:00
if err := os.RemoveAll(path); err != nil {
t.Fatalf("cannot remove %q: %s", path, err)
}
defer func() {
_ = os.RemoveAll(path)
}()
// Create a new table
strg := newTestStorage()
strg.retentionMsecs = retentionMsecs
tb := mustOpenTable(path, strg)
2019-05-22 21:16:55 +00:00
// Close it
tb.MustClose()
// Re-open created table multiple times.
for i := 0; i < 10; i++ {
tb := mustOpenTable(path, strg)
2019-05-22 21:16:55 +00:00
tb.MustClose()
}
}