Skip to content

Commit

Permalink
Merge pull request #14155 from influxdata/flux-staging
Browse files Browse the repository at this point in the history
update flux to v0.33.0
  • Loading branch information
aanthony1243 authored Jun 19, 2019
2 parents 4bd7320 + b9082de commit 9b8e6e8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 100 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect
github.com/hashicorp/raft v1.0.0 // indirect
github.com/hashicorp/vault/api v1.0.2
github.com/influxdata/flux v0.32.1
github.com/influxdata/flux v0.33.0
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6
github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368
github.com/jessevdk/go-flags v1.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/flux v0.32.1 h1:sPfPQrFuVwjh00bsZYW6xvRw2ILbINGmUrkuooI2ZyI=
github.com/influxdata/flux v0.32.1/go.mod h1:jvMlODMVoTjT8XESgISlGk1ldX0ME7mWcNGZ4Ssw3uw=
github.com/influxdata/flux v0.33.0 h1:9oQPJ8EJilFucVWwMmngCHUag68t3qM79FAMSdUNunk=
github.com/influxdata/flux v0.33.0/go.mod h1:jvMlODMVoTjT8XESgISlGk1ldX0ME7mWcNGZ4Ssw3uw=
github.com/influxdata/goreleaser v0.97.0-influx h1:jT5OrcW7WfS0e2QxfwmTBjhLvpIC9CDLRhNgZJyhj8s=
github.com/influxdata/goreleaser v0.97.0-influx/go.mod h1:MnjA0e0Uq6ISqjG1WxxMAl+3VS1QYjILSWVnMYDxasE=
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6 h1:CFx+pP90q/qg3spoiZjf8donE4WpAdjeJfPOcoNqkWo=
Expand Down
15 changes: 4 additions & 11 deletions http/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,11 @@ func (r QueryRequest) proxyRequest(now func() time.Time) (*query.ProxyRequest, e
// Query is preferred over AST
var compiler flux.Compiler
if r.Query != "" {
pkg, err := flux.Parse(r.Query)
if err != nil {
return nil, err
}
c := lang.ASTCompiler{
AST: pkg,
Now: now(),
compiler = lang.FluxCompiler{
Now: now(),
Extern: r.Extern,
Query: r.Query,
}
if r.Extern != nil {
c.PrependFile(r.Extern)
}
compiler = c
} else if r.AST != nil {
c := lang.ASTCompiler{
AST: r.AST,
Expand Down
105 changes: 19 additions & 86 deletions http/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,9 @@ func TestQueryRequest_proxyRequest(t *testing.T) {
now: func() time.Time { return time.Unix(1, 1) },
want: &query.ProxyRequest{
Request: query.Request{
Compiler: lang.ASTCompiler{
AST: &ast.Package{
Package: "main",
Files: []*ast.File{
{
Body: []ast.Statement{
&ast.ExpressionStatement{
Expression: &ast.Identifier{Name: "howdy"},
},
},
},
},
},
Now: time.Unix(1, 1),
Compiler: lang.FluxCompiler{
Now: time.Unix(1, 1),
Query: `howdy`,
},
},
Dialect: &csv.Dialect{
Expand Down Expand Up @@ -519,21 +508,8 @@ func Test_decodeProxyQueryRequest(t *testing.T) {
want: &query.ProxyRequest{
Request: query.Request{
OrganizationID: func() platform.ID { s, _ := platform.IDFromString("deadbeefdeadbeef"); return *s }(),
Compiler: lang.ASTCompiler{
AST: &ast.Package{
Package: "main",
Files: []*ast.File{
{
Body: []ast.Statement{
&ast.ExpressionStatement{
Expression: &ast.CallExpression{
Callee: &ast.Identifier{Name: "from"},
},
},
},
},
},
},
Compiler: lang.FluxCompiler{
Query: "from()",
},
},
Dialect: &csv.Dialect{
Expand Down Expand Up @@ -582,41 +558,18 @@ func Test_decodeProxyQueryRequest(t *testing.T) {
want: &query.ProxyRequest{
Request: query.Request{
OrganizationID: func() platform.ID { s, _ := platform.IDFromString("deadbeefdeadbeef"); return *s }(),
Compiler: lang.ASTCompiler{
AST: &ast.Package{
Package: "main",
Files: []*ast.File{
{
Body: []ast.Statement{
&ast.OptionStatement{
Assignment: &ast.VariableAssignment{
ID: &ast.Identifier{Name: "x"},
Init: &ast.IntegerLiteral{Value: 0},
},
},
},
},
{
Body: []ast.Statement{
&ast.ExpressionStatement{
Expression: &ast.CallExpression{
Callee: &ast.Identifier{Name: "from"},
Arguments: []ast.Expression{
&ast.ObjectExpression{
Properties: []*ast.Property{
{
Key: &ast.Identifier{Name: "bucket"},
Value: &ast.StringLiteral{Value: "mybucket"},
},
},
},
},
},
},
Compiler: lang.FluxCompiler{
Extern: &ast.File{
Body: []ast.Statement{
&ast.OptionStatement{
Assignment: &ast.VariableAssignment{
ID: &ast.Identifier{Name: "x"},
Init: &ast.IntegerLiteral{Value: 0},
},
},
},
},
Query: `from(bucket: "mybucket")`,
},
},
Dialect: &csv.Dialect{
Expand Down Expand Up @@ -646,31 +599,8 @@ func Test_decodeProxyQueryRequest(t *testing.T) {
want: &query.ProxyRequest{
Request: query.Request{
OrganizationID: func() platform.ID { s, _ := platform.IDFromString("deadbeefdeadbeef"); return *s }(),
Compiler: lang.ASTCompiler{
AST: &ast.Package{
Package: "main",
Files: []*ast.File{
{
Body: []ast.Statement{
&ast.ExpressionStatement{
Expression: &ast.CallExpression{
Callee: &ast.Identifier{Name: "from"},
Arguments: []ast.Expression{
&ast.ObjectExpression{
Properties: []*ast.Property{
{
Key: &ast.Identifier{Name: "bucket"},
Value: &ast.StringLiteral{Value: "mybucket"},
},
},
},
},
},
},
},
},
},
},
Compiler: lang.FluxCompiler{
Query: `from(bucket: "mybucket")`,
},
},
Dialect: &csv.Dialect{
Expand All @@ -682,7 +612,10 @@ func Test_decodeProxyQueryRequest(t *testing.T) {
},
},
}
cmpOptions := append(cmpOptions, cmpopts.IgnoreFields(lang.ASTCompiler{}, "Now"))
cmpOptions := append(cmpOptions,
cmpopts.IgnoreFields(lang.ASTCompiler{}, "Now"),
cmpopts.IgnoreFields(lang.FluxCompiler{}, "Now"),
)
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, _, err := decodeProxyQueryRequest(tt.args.ctx, tt.args.r, tt.args.auth, tt.args.svc)
Expand Down
2 changes: 2 additions & 0 deletions query/stdlib/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,6 @@ var FluxEndToEndSkipList = map[string]string{

"median_column": "failing in different ways (https://github.com/influxdata/influxdb/issues/13909)",
"dynamic_query": "panic when executing",

"regexp_replaceAllString": "Reason TBD",
}

0 comments on commit 9b8e6e8

Please sign in to comment.