parent
5a63037e76
commit
d08f5fe835
2
go.mod
2
go.mod
|
@ -62,7 +62,7 @@ require (
|
|||
github.com/hashicorp/vault v0.11.5
|
||||
github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e // indirect
|
||||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
|
||||
github.com/influxdata/flux v0.21.0
|
||||
github.com/influxdata/flux v0.21.1-0.20190228222340-efbe18bf7c4c
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6
|
||||
github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368
|
||||
github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -224,8 +224,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.21.0 h1:9Oz3lZg8BrFpJLv2+mqWsfnofPGZc56Upa+w8JxAWzg=
|
||||
github.com/influxdata/flux v0.21.0/go.mod h1:0f5Yrm4VPSd/Ne6jIVOVtPo0MFe6jpLCr6vdaZYp7wY=
|
||||
github.com/influxdata/flux v0.21.1-0.20190228222340-efbe18bf7c4c h1:8f9JrqtZCk6kTa4oQRpMYYVMVwOS8dwxFTrLn3bq53s=
|
||||
github.com/influxdata/flux v0.21.1-0.20190228222340-efbe18bf7c4c/go.mod h1:0f5Yrm4VPSd/Ne6jIVOVtPo0MFe6jpLCr6vdaZYp7wY=
|
||||
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=
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6/go.mod h1:KpVI7okXjK6PRi3Z5B+mtKZli+R1DnZgb3N+tzevNgo=
|
||||
|
|
|
@ -229,7 +229,7 @@ func (r QueryRequest) proxyRequest(now func() time.Time) (*query.ProxyRequest, e
|
|||
}
|
||||
c := lang.ASTCompiler{
|
||||
AST: pkg,
|
||||
Now: now,
|
||||
Now: now(),
|
||||
}
|
||||
if r.Extern != nil {
|
||||
c.PrependFile(r.Extern)
|
||||
|
@ -238,7 +238,7 @@ func (r QueryRequest) proxyRequest(now func() time.Time) (*query.ProxyRequest, e
|
|||
} else if r.AST != nil {
|
||||
c := lang.ASTCompiler{
|
||||
AST: r.AST,
|
||||
Now: now,
|
||||
Now: now(),
|
||||
}
|
||||
if r.Extern != nil {
|
||||
c.PrependFile(r.Extern)
|
||||
|
|
|
@ -22,19 +22,6 @@ import (
|
|||
_ "github.com/influxdata/influxdb/query/builtin"
|
||||
)
|
||||
|
||||
var compareASTCompiler = func(x, y lang.ASTCompiler) bool {
|
||||
if x.Now == nil && y.Now != nil {
|
||||
return false
|
||||
}
|
||||
if x.Now != nil && y.Now == nil {
|
||||
return false
|
||||
}
|
||||
if x.Now != nil && y.Now != nil && !x.Now().Equal(y.Now()) {
|
||||
return false
|
||||
}
|
||||
return cmp.Equal(x.AST, y.AST, cmpopts.IgnoreTypes(ast.BaseNode{}))
|
||||
}
|
||||
|
||||
var cmpOptions = cmp.Options{
|
||||
cmpopts.IgnoreTypes(ast.BaseNode{}),
|
||||
cmpopts.IgnoreUnexported(query.ProxyRequest{}),
|
||||
|
@ -267,7 +254,7 @@ func TestQueryRequest_proxyRequest(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
Now: func() time.Time { return time.Unix(1, 1) },
|
||||
Now: time.Unix(1,1),
|
||||
},
|
||||
},
|
||||
Dialect: &csv.Dialect{
|
||||
|
@ -294,7 +281,7 @@ func TestQueryRequest_proxyRequest(t *testing.T) {
|
|||
Request: query.Request{
|
||||
Compiler: lang.ASTCompiler{
|
||||
AST: &ast.Package{},
|
||||
Now: func() time.Time { return time.Unix(1, 1) },
|
||||
Now: time.Unix(1,1),
|
||||
},
|
||||
},
|
||||
Dialect: &csv.Dialect{
|
||||
|
@ -344,7 +331,7 @@ func TestQueryRequest_proxyRequest(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
Now: func() time.Time { return time.Unix(1, 1) },
|
||||
Now: time.Unix(1,1),
|
||||
},
|
||||
},
|
||||
Dialect: &csv.Dialect{
|
||||
|
@ -385,7 +372,6 @@ func TestQueryRequest_proxyRequest(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}
|
||||
cmpOptions := append(cmpOptions, cmp.Comparer(compareASTCompiler))
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
r := QueryRequest{
|
||||
|
|
Loading…
Reference in New Issue