Skip to content

Commit

Permalink
feat(fluxtest): add support for testing/expect planner rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jsternberg committed Feb 1, 2021
1 parent d5aa736 commit 3b69c70
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
8 changes: 7 additions & 1 deletion cmd/influxd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"time"

"github.com/influxdata/flux"
"github.com/influxdata/flux/dependencies/testing"
platform "github.com/influxdata/influxdb/v2"
"github.com/influxdata/influxdb/v2/authorization"
"github.com/influxdata/influxdb/v2/authorizer"
Expand Down Expand Up @@ -423,14 +424,19 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
return err
}

dependencyList := []flux.Dependency{deps}
if opts.Testing {
dependencyList = append(dependencyList, testing.FrameworkConfig{})
}

m.queryController, err = control.New(control.Config{
ConcurrencyQuota: opts.ConcurrencyQuota,
InitialMemoryBytesQuotaPerQuery: opts.InitialMemoryBytesQuotaPerQuery,
MemoryBytesQuotaPerQuery: opts.MemoryBytesQuotaPerQuery,
MaxMemoryBytes: opts.MaxMemoryBytes,
QueueSize: opts.QueueSize,
Logger: m.log.With(zap.String("service", "storage-reads")),
ExecutorDependencies: []flux.Dependency{deps},
ExecutorDependencies: dependencyList,
})
if err != nil {
m.log.Error("Failed to create query controller", zap.Error(err))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ require (
github.com/hashicorp/vault/api v1.0.2
github.com/imdario/mergo v0.3.9 // indirect
github.com/influxdata/cron v0.0.0-20191203200038-ded12750aac6
github.com/influxdata/flux v0.101.0
github.com/influxdata/flux v0.102.1-0.20210128223158-ee5c439c1ae1
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6
github.com/influxdata/pkg-config v0.2.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/cron v0.0.0-20191203200038-ded12750aac6 h1:OtjKkeWDjUbyMi82C7XXy7Tvm2LXMwiBBXyFIGNPaGA=
github.com/influxdata/cron v0.0.0-20191203200038-ded12750aac6/go.mod h1:XabtPPW2qsCg0tl+kjaPU+cFS+CjQXEXbT1VJvHT4og=
github.com/influxdata/flux v0.101.0 h1:Ca9CWrJ7JaGJcINLu4V7CgUQO3fKI0EgpN3Q2SMLjqM=
github.com/influxdata/flux v0.101.0/go.mod h1:/geA7c1dxlmQu3deZ8TukVe3wmVapqaq4y1A2o18OaM=
github.com/influxdata/flux v0.102.1-0.20210128223158-ee5c439c1ae1 h1:mavVtrkEdEYT253kNVsLhC5zugiRbx2jWuwrSpItu/4=
github.com/influxdata/flux v0.102.1-0.20210128223158-ee5c439c1ae1/go.mod h1:QEVEEaLEVtLXJ9YQzvVLVMoCmElUyqkFYSjfy1BEKiE=
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69 h1:WQsmW0fXO4ZE/lFGIE84G6rIV5SJN3P3sjIXAP1a8eU=
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69/go.mod h1:pwymjR6SrP3gD3pRj9RJwdl1j5s3doEEV8gS4X9qSzA=
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6 h1:CFx+pP90q/qg3spoiZjf8donE4WpAdjeJfPOcoNqkWo=
Expand Down
5 changes: 0 additions & 5 deletions internal/cmd/fluxtest-harness-influxdb/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/influxdata/flux/execute/table"
"github.com/influxdata/flux/lang"
"github.com/influxdata/flux/parser"
"github.com/influxdata/flux/stdlib"
"github.com/influxdata/influxdb/v2"
"github.com/influxdata/influxdb/v2/cmd/influxd/launcher"
"github.com/influxdata/influxdb/v2/query"
Expand Down Expand Up @@ -114,10 +113,6 @@ func (t *testExecutor) executeWithOptions(bucketOpt, orgOpt *ast.OptionStatement
pkg = pkg.Copy().(*ast.Package)
pkg.Files = append(pkg.Files, options)

// Use testing.inspect call to get all of diff, want, and got
inspectCalls := stdlib.TestingInspectCalls(pkg)
pkg.Files = append(pkg.Files, inspectCalls)

bs, err := json.Marshal(pkg)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions query/stdlib/testing/end_to_end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ func executeWithOptions(t testing.TB, l *launcher.TestLauncher, bucketOpt *ast.O

// Use testing.inspect call to get all of diff, want, and got
inspectCalls := stdlib.TestingInspectCalls(pkg)
if len(inspectCalls.Body) == 0 {
t.Skip("no tests found")
return nil
}
pkg.Files = append(pkg.Files, inspectCalls)

bs, err := json.Marshal(pkg)
Expand Down
8 changes: 4 additions & 4 deletions query/stdlib/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ var FluxEndToEndSkipList = map[string]map[string]string{
"holt_winters_panic": "Expected output is an empty table which breaks the testing framework (https://github.com/influxdata/influxdb/issues/14749)",
"map_nulls": "to cannot write null values",
},
"array": {
"from": "test not meant to be consumed by influxdb",
"from_group": "test not meant to be consumed by influxdb",
},
"experimental": {
"set": "Reason TBD",
"join": "unbounded test",
"alignTime": "unbounded test",
},
"experimental/array": {
"from": "test not meant to be consumed by influxdb",
"from_group": "test not meant to be consumed by influxdb",
},
"experimental/geo": {
"filterRowsNotStrict": "tableFind does not work in e2e tests: https://github.com/influxdata/influxdb/issues/13975",
"filterRowsStrict": "tableFind does not work in e2e tests: https://github.com/influxdata/influxdb/issues/13975",
Expand Down

0 comments on commit 3b69c70

Please sign in to comment.