2018-10-31 21:19:17 +00:00
|
|
|
package tsi1
|
|
|
|
|
|
|
|
import (
|
2019-03-04 19:48:11 +00:00
|
|
|
"context"
|
2018-10-31 21:19:17 +00:00
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
2019-01-08 00:37:16 +00:00
|
|
|
"github.com/influxdata/influxdb/tsdb"
|
2018-10-31 21:19:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestLegacyOpen(t *testing.T) {
|
|
|
|
dir, err := ioutil.TempDir("", "tsi1-")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
os.RemoveAll(dir)
|
|
|
|
|
|
|
|
sfile := tsdb.NewSeriesFile(dir)
|
2019-03-04 19:48:11 +00:00
|
|
|
if err := sfile.Open(context.Background()); err != nil {
|
2018-10-31 21:19:17 +00:00
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
defer sfile.Close()
|
|
|
|
|
2018-10-31 19:19:54 +00:00
|
|
|
index := NewIndex(sfile, NewConfig(), WithPath("testdata/index-file-index"))
|
2019-03-04 19:48:11 +00:00
|
|
|
if err := index.Open(context.Background()); err != nil {
|
2018-10-31 21:19:17 +00:00
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
defer index.Close()
|
|
|
|
|
|
|
|
// check that we can read all the measurements
|
|
|
|
err = index.ForEachMeasurementName(func(name []byte) error { return nil })
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|