fix TestDropMeasurementStatement
parent
636b4d1603
commit
6f0ba18904
|
@ -193,7 +193,7 @@ func (e *Engine) LoadMetadataIndex(index *tsdb.DatabaseIndex, measurementFields
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// now flush the metadata that was in the WAL, but hand't yet been flushed
|
// now flush the metadata that was in the WAL, but hadn't yet been flushed
|
||||||
if err := e.WAL.LoadMetadataIndex(index, measurementFields); err != nil {
|
if err := e.WAL.LoadMetadataIndex(index, measurementFields); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -553,7 +553,6 @@ func (q *QueryExecutor) filterShowSeriesResult(limit, offset int, rows influxql.
|
||||||
// PlanShowMeasurements creates an execution plan for the given SelectStatement and returns an Executor.
|
// PlanShowMeasurements creates an execution plan for the given SelectStatement and returns an Executor.
|
||||||
func (q *QueryExecutor) PlanShowMeasurements(stmt *influxql.ShowMeasurementsStatement, database string, chunkSize int) (Executor, error) {
|
func (q *QueryExecutor) PlanShowMeasurements(stmt *influxql.ShowMeasurementsStatement, database string, chunkSize int) (Executor, error) {
|
||||||
// Get the database info.
|
// Get the database info.
|
||||||
fmt.Printf("database = %s\n", database)
|
|
||||||
di, err := q.MetaStore.Database(database)
|
di, err := q.MetaStore.Database(database)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -18,7 +18,7 @@ var sgID = uint64(2)
|
||||||
var shardID = uint64(1)
|
var shardID = uint64(1)
|
||||||
|
|
||||||
func TestWritePointsAndExecuteQuery(t *testing.T) {
|
func TestWritePointsAndExecuteQuery(t *testing.T) {
|
||||||
store, executor := testStoreAndExecutor()
|
store, executor := testStoreAndExecutor("")
|
||||||
defer os.RemoveAll(store.Path())
|
defer os.RemoveAll(store.Path())
|
||||||
|
|
||||||
// Write first point.
|
// Write first point.
|
||||||
|
@ -71,7 +71,7 @@ func TestWritePointsAndExecuteQuery(t *testing.T) {
|
||||||
|
|
||||||
// Ensure writing a point and updating it results in only a single point.
|
// Ensure writing a point and updating it results in only a single point.
|
||||||
func TestWritePointsAndExecuteQuery_Update(t *testing.T) {
|
func TestWritePointsAndExecuteQuery_Update(t *testing.T) {
|
||||||
store, executor := testStoreAndExecutor()
|
store, executor := testStoreAndExecutor("")
|
||||||
defer os.RemoveAll(store.Path())
|
defer os.RemoveAll(store.Path())
|
||||||
|
|
||||||
// Write original point.
|
// Write original point.
|
||||||
|
@ -113,7 +113,7 @@ func TestWritePointsAndExecuteQuery_Update(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDropSeriesStatement(t *testing.T) {
|
func TestDropSeriesStatement(t *testing.T) {
|
||||||
store, executor := testStoreAndExecutor()
|
store, executor := testStoreAndExecutor("")
|
||||||
defer os.RemoveAll(store.Path())
|
defer os.RemoveAll(store.Path())
|
||||||
|
|
||||||
pt := tsdb.NewPoint(
|
pt := tsdb.NewPoint(
|
||||||
|
@ -169,7 +169,7 @@ func TestDropSeriesStatement(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDropMeasurementStatement(t *testing.T) {
|
func TestDropMeasurementStatement(t *testing.T) {
|
||||||
store, executor := testStoreAndExecutor()
|
store, executor := testStoreAndExecutor("")
|
||||||
defer os.RemoveAll(store.Path())
|
defer os.RemoveAll(store.Path())
|
||||||
|
|
||||||
pt := tsdb.NewPoint(
|
pt := tsdb.NewPoint(
|
||||||
|
@ -221,11 +221,7 @@ func TestDropMeasurementStatement(t *testing.T) {
|
||||||
|
|
||||||
validateDrop()
|
validateDrop()
|
||||||
store.Close()
|
store.Close()
|
||||||
conf := store.EngineOptions.Config
|
store, executor = testStoreAndExecutor(store.Path())
|
||||||
store = tsdb.NewStore(store.Path())
|
|
||||||
store.EngineOptions.Config = conf
|
|
||||||
store.Open()
|
|
||||||
executor.Store = store
|
|
||||||
validateDrop()
|
validateDrop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +235,7 @@ func (m *metaExec) ExecuteStatement(stmt influxql.Statement) *influxql.Result {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDropDatabase(t *testing.T) {
|
func TestDropDatabase(t *testing.T) {
|
||||||
store, executor := testStoreAndExecutor()
|
store, executor := testStoreAndExecutor("")
|
||||||
defer os.RemoveAll(store.Path())
|
defer os.RemoveAll(store.Path())
|
||||||
|
|
||||||
pt := tsdb.NewPoint(
|
pt := tsdb.NewPoint(
|
||||||
|
@ -301,7 +297,7 @@ func TestDropDatabase(t *testing.T) {
|
||||||
|
|
||||||
// Ensure that queries for which there is no data result in an empty set.
|
// Ensure that queries for which there is no data result in an empty set.
|
||||||
func TestQueryNoData(t *testing.T) {
|
func TestQueryNoData(t *testing.T) {
|
||||||
store, executor := testStoreAndExecutor()
|
store, executor := testStoreAndExecutor("")
|
||||||
defer os.RemoveAll(store.Path())
|
defer os.RemoveAll(store.Path())
|
||||||
|
|
||||||
got := executeAndGetJSON("select * from /.*/", executor)
|
got := executeAndGetJSON("select * from /.*/", executor)
|
||||||
|
@ -322,7 +318,7 @@ func TestQueryNoData(t *testing.T) {
|
||||||
// ensure that authenticate doesn't return an error if the user count is zero and they're attempting
|
// ensure that authenticate doesn't return an error if the user count is zero and they're attempting
|
||||||
// to create a user.
|
// to create a user.
|
||||||
func TestAuthenticateIfUserCountZeroAndCreateUser(t *testing.T) {
|
func TestAuthenticateIfUserCountZeroAndCreateUser(t *testing.T) {
|
||||||
store, executor := testStoreAndExecutor()
|
store, executor := testStoreAndExecutor("")
|
||||||
defer os.RemoveAll(store.Path())
|
defer os.RemoveAll(store.Path())
|
||||||
ms := &testMetastore{userCount: 0}
|
ms := &testMetastore{userCount: 0}
|
||||||
executor.MetaStore = ms
|
executor.MetaStore = ms
|
||||||
|
@ -350,11 +346,13 @@ func TestAuthenticateIfUserCountZeroAndCreateUser(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testStoreAndExecutor() (*tsdb.Store, *tsdb.QueryExecutor) {
|
func testStoreAndExecutor(storePath string) (*tsdb.Store, *tsdb.QueryExecutor) {
|
||||||
path, _ := ioutil.TempDir("", "")
|
if storePath == "" {
|
||||||
|
storePath, _ = ioutil.TempDir("", "")
|
||||||
|
}
|
||||||
|
|
||||||
store := tsdb.NewStore(path)
|
store := tsdb.NewStore(storePath)
|
||||||
store.EngineOptions.Config.WALDir = filepath.Join(path, "wal")
|
store.EngineOptions.Config.WALDir = filepath.Join(storePath, "wal")
|
||||||
|
|
||||||
err := store.Open()
|
err := store.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue