Fix expected flux cases

pull/12391/head
Edd Robinson 2019-03-06 11:01:26 +00:00
parent 3f1bec0836
commit 8bdf857ddb
4 changed files with 7 additions and 7 deletions

View File

@ -75,7 +75,7 @@ func TestLauncher_WriteAndQuery(t *testing.T) {
// Query server to ensure write persists.
qs := `from(bucket:"BUCKET") |> range(start:2000-01-01T00:00:00Z,stop:2000-01-02T00:00:00Z)`
exp := `,result,table,_start,_stop,_time,_value,_measurement,k,_field` + "\r\n" +
`,result,table,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,100,m,v,f` + "\r\n\r\n"
`,_result,0,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,100,m,v,f` + "\r\n\r\n"
buf, err := http.SimpleQuery(l.URL(), qs, l.Org.Name, l.Auth.Token)
if err != nil {
@ -113,7 +113,7 @@ func TestLauncher_BucketDelete(t *testing.T) {
// Query server to ensure write persists.
qs := `from(bucket:"BUCKET") |> range(start:2000-01-01T00:00:00Z,stop:2000-01-02T00:00:00Z)`
exp := `,result,table,_start,_stop,_time,_value,_measurement,k,_field` + "\r\n" +
`,result,table,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,100,m,v,f` + "\r\n\r\n"
`,_result,0,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,100,m,v,f` + "\r\n\r\n"
buf, err := http.SimpleQuery(l.URL(), qs, l.Org.Name, l.Auth.Token)
if err != nil {

View File

@ -36,13 +36,13 @@ func TestStorage_WriteAndQuery(t *testing.T) {
qs := `from(bucket:"BUCKET") |> range(start:2000-01-01T00:00:00Z,stop:2000-01-02T00:00:00Z)`
exp := `,result,table,_start,_stop,_time,_value,_measurement,k,_field` + "\r\n" +
`,result,table,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,100,m,v1,f` + "\r\n\r\n"
`,_result,0,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,100,m,v1,f` + "\r\n\r\n"
if got := l.FluxQueryOrFail(t, org1.Org, org1.Auth.Token, qs); !cmp.Equal(got, exp) {
t.Errorf("unexpected query results -got/+exp\n%s", cmp.Diff(got, exp))
}
exp = `,result,table,_start,_stop,_time,_value,_measurement,k,_field` + "\r\n" +
`,result,table,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,200,m,v2,f` + "\r\n\r\n"
`,_result,0,2000-01-01T00:00:00Z,2000-01-02T00:00:00Z,2000-01-01T00:00:00Z,200,m,v2,f` + "\r\n\r\n"
if got := l.FluxQueryOrFail(t, org2.Org, org2.Auth.Token, qs); !cmp.Equal(got, exp) {
t.Errorf("unexpected query results -got/+exp\n%s", cmp.Diff(got, exp))
}

View File

@ -131,7 +131,7 @@ func TestFluxQueryService_Query(t *testing.T) {
,result,table,_time,usage_user,test,mystr,this,cpu,host,_measurement
,,0,2018-08-29T13:08:47Z,10.2,10,yay,true,cpu-total,a,cpui
`,
want: toCRLF(`,_result,0,2018-08-29T13:08:47Z,10.2,10,yay,true,cpu-total,a,cpui
want: toCRLF(`,0,0,2018-08-29T13:08:47Z,10.2,10,yay,true,cpu-total,a,cpui
`),
},

View File

@ -137,9 +137,9 @@ func (c *indexSeriesCursor) Next() *reads.SeriesRow {
}
for i := 0; i < len(c.row.Tags); i++ {
if bytes.Equal(c.row.Tags[i].Key, tsdb.MeasurementInternalTagKeyBytes) {
if bytes.Equal(c.row.Tags[i].Key, models.MeasurementTagKeyBytes) {
c.row.Tags[i].Key = measurementKeyBytes
} else if bytes.Equal(c.row.Tags[i].Key, tsdb.FieldKeyInternalTagKeyBytes) {
} else if bytes.Equal(c.row.Tags[i].Key, models.FieldKeyTagKeyBytes) {
c.row.Tags[i].Key = fieldKeyBytes
}
}