fix(fluxtest): fix load storage to read/write the bucket correctly (#21058)

pull/21084/head
Jonathan A. Sternberg 2021-03-26 15:58:04 -05:00 committed by GitHub
parent d7ecd6e5fa
commit 7b74bb41fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 5 deletions

View File

@ -33,7 +33,7 @@ build_test_harness() {
run_integration_tests() {
log "Running integration tests..."
./fluxtest -v -p flux.zip
./fluxtest -v -p flux.zip -p query/
}
cleanup() {

2
go.mod
View File

@ -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.109.1
github.com/influxdata/flux v0.110.0
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

4
go.sum
View File

@ -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.109.1 h1:1r/qjnpko86037dW6KxGRx3LWrLcIPoeP8E5lcA9sPc=
github.com/influxdata/flux v0.109.1/go.mod h1:3TJtvbm/Kwuo5/PEo5P6HUzwVg4bXWkb2wPQHPtQdlU=
github.com/influxdata/flux v0.110.0 h1:zhhMhXt+MQDJGP7HqyuJL6SVh3D96JlP5nkurKzKnTA=
github.com/influxdata/flux v0.110.0/go.mod h1:3TJtvbm/Kwuo5/PEo5P6HUzwVg4bXWkb2wPQHPtQdlU=
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=

View File

@ -111,7 +111,7 @@ func (t *testExecutor) executeWithOptions(bucketOpt, orgOpt *ast.OptionStatement
// Add options to pkg
pkg = pkg.Copy().(*ast.Package)
pkg.Files = append(pkg.Files, options)
pkg.Files = append([]*ast.File{options}, pkg.Files...)
bs, err := json.Marshal(pkg)
if err != nil {

View File

@ -0,0 +1 @@
influxdb

View File

@ -0,0 +1,41 @@
package influxdb_test
import "csv"
import "testing"
import "testing/expect"
option now = () => (2030-01-01T00:00:00Z)
input = "#datatype,string,long,dateTime:RFC3339,string,string,string,double
#group,false,false,false,true,true,true,false
#default,_result,,,,,,
,result,table,_time,_measurement,host,_field,_value
,,0,2018-05-22T19:53:26Z,system,host.local,load1,1.83
,,0,2018-05-22T19:53:36Z,system,host.local,load1,1.63
,,1,2018-05-22T19:53:26Z,system,host.local,load3,1.72
,,2,2018-05-22T19:53:26Z,system,host.local,load4,1.77
,,2,2018-05-22T19:53:36Z,system,host.local,load4,1.78
,,2,2018-05-22T19:53:46Z,system,host.local,load4,1.77
"
testcase filter {
expect.planner(rules: [
"influxdata/influxdb.FromStorageRule": 1,
"PushDownRangeRule": 1,
"PushDownFilterRule": 1,
])
want = csv.from(csv: "#datatype,string,long,dateTime:RFC3339,string,string,string,double
#group,false,false,false,true,true,true,false
#default,_result,,,,,,
,result,table,_time,_measurement,host,_field,_value
,,0,2018-05-22T19:53:26Z,system,host.local,load1,1.83
,,0,2018-05-22T19:53:36Z,system,host.local,load1,1.63
")
got = testing.loadStorage(csv: input)
|> range(start: -100y)
|> filter(fn: (r) => r._measurement == "system" and r._field == "load1")
|> drop(columns: ["_start", "_stop"])
testing.diff(want, got)
}