Skip to content

Commit

Permalink
feat: add additional log to flux e2e tests (#22366) (#22370)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamhbaker authored Sep 2, 2021
1 parent cac1c6c commit e8ed843
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions query/stdlib/testing/end_to_end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"strings"
"testing"

Expand All @@ -18,6 +19,7 @@ import (
platform "github.com/influxdata/influxdb/v2"
"github.com/influxdata/influxdb/v2/cmd/influxd/launcher"
influxdbcontext "github.com/influxdata/influxdb/v2/context"
"github.com/influxdata/influxdb/v2/http"
"github.com/influxdata/influxdb/v2/kit/feature"
"github.com/influxdata/influxdb/v2/kit/feature/override"
"github.com/influxdata/influxdb/v2/mock"
Expand Down Expand Up @@ -246,10 +248,23 @@ func testFlux(t testing.TB, l *launcher.TestLauncher, file *ast.File) {
logFormatted("diff", results)
logFormatted("want", results)
logFormatted("got", results)

t.Logf("all data in %s:", t.Name())
logFormatted(t.Name(), allDataFromBucket(t, l, t.Name()))
}
}
}

func allDataFromBucket(t testing.TB, l *launcher.TestLauncher, bucket string) map[string]*bytes.Buffer {
q := fmt.Sprintf(`from(bucket: "%s") |> range(start: 0)`, bucket)
bs, err := http.SimpleQuery(l.URL(), q, l.Org.Name, l.Auth.Token)
if err != nil {
t.Fatal(err)
}

return map[string]*bytes.Buffer{bucket: bytes.NewBuffer(bs)}
}

func executeWithOptions(t testing.TB, l *launcher.TestLauncher, bucketOpt *ast.OptionStatement,
orgOpt *ast.OptionStatement, optionsAST *ast.File, file *ast.File) map[string]*bytes.Buffer {
var results map[string]*bytes.Buffer
Expand Down

0 comments on commit e8ed843

Please sign in to comment.