mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
e0e856d2e7
* Introduce flagutil.Duration To avoid conversion bugs * Fix tests * Comment why not .Seconds()
34 lines
612 B
Go
34 lines
612 B
Go
package storage
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestTableOpenClose(t *testing.T) {
|
|
const path = "TestTableOpenClose"
|
|
const retention = 123 * retentionMonth
|
|
|
|
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 = retention.Milliseconds()
|
|
tb := mustOpenTable(path, strg)
|
|
|
|
// Close it
|
|
tb.MustClose()
|
|
|
|
// Re-open created table multiple times.
|
|
for i := 0; i < 10; i++ {
|
|
tb := mustOpenTable(path, strg)
|
|
tb.MustClose()
|
|
}
|
|
|
|
stopTestStorage(strg)
|
|
}
|