chore(storageflux): update failing tests
parent
42856e1394
commit
eeece73675
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/influxdata/influxdb/pkg/data/gen"
|
"github.com/influxdata/influxdb/pkg/data/gen"
|
||||||
"github.com/influxdata/influxdb/query/stdlib/influxdata/influxdb"
|
"github.com/influxdata/influxdb/query/stdlib/influxdata/influxdb"
|
||||||
"github.com/influxdata/influxdb/storage"
|
"github.com/influxdata/influxdb/storage"
|
||||||
|
storageflux "github.com/influxdata/influxdb/storage/flux"
|
||||||
"github.com/influxdata/influxdb/storage/readservice"
|
"github.com/influxdata/influxdb/storage/readservice"
|
||||||
"go.uber.org/zap/zaptest"
|
"go.uber.org/zap/zaptest"
|
||||||
)
|
)
|
||||||
|
@ -153,7 +154,7 @@ func benchmarkRead(b *testing.B, sg gen.SeriesGenerator, f func(r influxdb.Reade
|
||||||
if err := engine.Open(context.Background()); err != nil {
|
if err := engine.Open(context.Background()); err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
reader := NewReader(readservice.NewStore(engine))
|
reader := storageflux.NewReader(readservice.NewStore(engine))
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/influxdata/influxdb/models"
|
"github.com/influxdata/influxdb/models"
|
||||||
"github.com/influxdata/influxdb/storage"
|
"github.com/influxdata/influxdb/storage"
|
||||||
|
"github.com/influxdata/influxdb/storage/reads/datatypes"
|
||||||
"github.com/influxdata/influxql"
|
"github.com/influxdata/influxql"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ func TestPlannerCondition(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
expr := fmt.Sprintf(`(%[1]s = 'cpu' AND (%[2]s = 'user' OR %[2]s = 'system')) OR (%[1]s = 'mem' AND "_value" = 0)`, measurementKey, fieldKey)
|
expr := fmt.Sprintf(`(%[1]s = 'cpu' AND (%[2]s = 'user' OR %[2]s = 'system')) OR (%[1]s = 'mem' AND "_value" = 0)`, datatypes.MeasurementKey, datatypes.FieldKey)
|
||||||
cond, err := parseExpr(expr)
|
cond, err := parseExpr(expr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("ParseExpr", err)
|
t.Fatal("ParseExpr", err)
|
||||||
|
@ -61,7 +62,7 @@ func TestPlannerCondition(t *testing.T) {
|
||||||
expr = `org_bucket,%[2]s=system,%[1]s=cpu,host=host1
|
expr = `org_bucket,%[2]s=system,%[1]s=cpu,host=host1
|
||||||
org_bucket,%[2]s=user,%[1]s=mem,host=host1`
|
org_bucket,%[2]s=user,%[1]s=mem,host=host1`
|
||||||
|
|
||||||
expr = fmt.Sprintf(expr, measurementKey, fieldKey)
|
expr = fmt.Sprintf(expr, datatypes.MeasurementKey, datatypes.FieldKey)
|
||||||
|
|
||||||
exp := strings.Split(expr, "\n")
|
exp := strings.Split(expr, "\n")
|
||||||
if !cmp.Equal(exp, keys) {
|
if !cmp.Equal(exp, keys) {
|
||||||
|
@ -80,9 +81,9 @@ func parseExpr(expr string) (influxql.Expr, error) {
|
||||||
e = influxql.RewriteExpr(e, func(expr influxql.Expr) influxql.Expr {
|
e = influxql.RewriteExpr(e, func(expr influxql.Expr) influxql.Expr {
|
||||||
if vr, ok := expr.(*influxql.VarRef); ok {
|
if vr, ok := expr.(*influxql.VarRef); ok {
|
||||||
switch vr.Val {
|
switch vr.Val {
|
||||||
case measurementKey:
|
case datatypes.MeasurementKey:
|
||||||
vr.Val = models.MeasurementTagKey
|
vr.Val = models.MeasurementTagKey
|
||||||
case fieldKey:
|
case datatypes.FieldKey:
|
||||||
vr.Val = models.FieldKeyTagKey
|
vr.Val = models.FieldKeyTagKey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue