Update tests to use Direction enum

pull/3986/head
Jason Wilder 2015-09-04 08:51:48 -06:00
parent 330363bec4
commit df70a1c8ce
4 changed files with 48 additions and 48 deletions

View File

@ -2204,7 +2204,7 @@ func TestServer_Query_Aggregates(t *testing.T) {
// order by time desc // order by time desc
&Query{ &Query{
name: "order by time desc", name: "aggregate order by time desc",
params: url.Values{"db": []string{"db0"}}, params: url.Values{"db": []string{"db0"}},
command: `SELECT max(value) FROM intmany where time >= '2000-01-01T00:00:00Z' AND time <= '2000-01-01T00:01:00Z' group by time(10s) order by time desc`, command: `SELECT max(value) FROM intmany where time >= '2000-01-01T00:00:00Z' AND time <= '2000-01-01T00:01:00Z' group by time(10s) order by time desc`,
exp: `{"results":[{"series":[{"name":"intmany","columns":["time","max"],"values":[["2000-01-01T00:01:00Z",7],["2000-01-01T00:00:50Z",5],["2000-01-01T00:00:40Z",5],["2000-01-01T00:00:30Z",4],["2000-01-01T00:00:20Z",4],["2000-01-01T00:00:10Z",4],["2000-01-01T00:00:00Z",2]]}]}]}`, exp: `{"results":[{"series":[{"name":"intmany","columns":["time","max"],"values":[["2000-01-01T00:01:00Z",7],["2000-01-01T00:00:50Z",5],["2000-01-01T00:00:40Z",5],["2000-01-01T00:00:30Z",4],["2000-01-01T00:00:20Z",4],["2000-01-01T00:00:10Z",4],["2000-01-01T00:00:00Z",2]]}]}]}`,

View File

@ -14,8 +14,8 @@ import (
// Ensure the multi-cursor can correctly iterate across a single subcursor. // Ensure the multi-cursor can correctly iterate across a single subcursor.
func TestMultiCursor_Single(t *testing.T) { func TestMultiCursor_Single(t *testing.T) {
mc := tsdb.MultiCursor(true, mc := tsdb.MultiCursor(tsdb.Forward,
NewCursor(true, []CursorItem{ NewCursor(tsdb.Forward, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0x00}}, {Key: []byte{0x00}, Value: []byte{0x00}},
{Key: []byte{0x01}, Value: []byte{0x10}}, {Key: []byte{0x01}, Value: []byte{0x10}},
{Key: []byte{0x02}, Value: []byte{0x20}}, {Key: []byte{0x02}, Value: []byte{0x20}},
@ -35,8 +35,8 @@ func TestMultiCursor_Single(t *testing.T) {
// Ensure the multi-cursor can correctly iterate across a single subcursor in reverse order. // Ensure the multi-cursor can correctly iterate across a single subcursor in reverse order.
func TestMultiCursor_Single_Reverse(t *testing.T) { func TestMultiCursor_Single_Reverse(t *testing.T) {
mc := tsdb.MultiCursor(false, mc := tsdb.MultiCursor(tsdb.Reverse,
NewCursor(false, []CursorItem{ NewCursor(tsdb.Reverse, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0x00}}, {Key: []byte{0x00}, Value: []byte{0x00}},
{Key: []byte{0x01}, Value: []byte{0x10}}, {Key: []byte{0x01}, Value: []byte{0x10}},
{Key: []byte{0x02}, Value: []byte{0x20}}, {Key: []byte{0x02}, Value: []byte{0x20}},
@ -56,13 +56,13 @@ func TestMultiCursor_Single_Reverse(t *testing.T) {
// Ensure the multi-cursor can correctly iterate across multiple non-overlapping subcursors. // Ensure the multi-cursor can correctly iterate across multiple non-overlapping subcursors.
func TestMultiCursor_Multiple_NonOverlapping(t *testing.T) { func TestMultiCursor_Multiple_NonOverlapping(t *testing.T) {
mc := tsdb.MultiCursor(true, mc := tsdb.MultiCursor(tsdb.Forward,
NewCursor(true, []CursorItem{ NewCursor(tsdb.Forward, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0x00}}, {Key: []byte{0x00}, Value: []byte{0x00}},
{Key: []byte{0x03}, Value: []byte{0x30}}, {Key: []byte{0x03}, Value: []byte{0x30}},
{Key: []byte{0x04}, Value: []byte{0x40}}, {Key: []byte{0x04}, Value: []byte{0x40}},
}), }),
NewCursor(true, []CursorItem{ NewCursor(tsdb.Forward, []CursorItem{
{Key: []byte{0x01}, Value: []byte{0x10}}, {Key: []byte{0x01}, Value: []byte{0x10}},
{Key: []byte{0x02}, Value: []byte{0x20}}, {Key: []byte{0x02}, Value: []byte{0x20}},
}), }),
@ -85,13 +85,13 @@ func TestMultiCursor_Multiple_NonOverlapping(t *testing.T) {
// Ensure the multi-cursor can correctly iterate across multiple non-overlapping subcursors. // Ensure the multi-cursor can correctly iterate across multiple non-overlapping subcursors.
func TestMultiCursor_Multiple_NonOverlapping_Reverse(t *testing.T) { func TestMultiCursor_Multiple_NonOverlapping_Reverse(t *testing.T) {
mc := tsdb.MultiCursor(false, mc := tsdb.MultiCursor(tsdb.Reverse,
NewCursor(false, []CursorItem{ NewCursor(tsdb.Reverse, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0x00}}, {Key: []byte{0x00}, Value: []byte{0x00}},
{Key: []byte{0x03}, Value: []byte{0x30}}, {Key: []byte{0x03}, Value: []byte{0x30}},
{Key: []byte{0x04}, Value: []byte{0x40}}, {Key: []byte{0x04}, Value: []byte{0x40}},
}), }),
NewCursor(false, []CursorItem{ NewCursor(tsdb.Reverse, []CursorItem{
{Key: []byte{0x01}, Value: []byte{0x10}}, {Key: []byte{0x01}, Value: []byte{0x10}},
{Key: []byte{0x02}, Value: []byte{0x20}}, {Key: []byte{0x02}, Value: []byte{0x20}},
}), }),
@ -114,13 +114,13 @@ func TestMultiCursor_Multiple_NonOverlapping_Reverse(t *testing.T) {
// Ensure the multi-cursor can correctly iterate across multiple overlapping subcursors. // Ensure the multi-cursor can correctly iterate across multiple overlapping subcursors.
func TestMultiCursor_Multiple_Overlapping(t *testing.T) { func TestMultiCursor_Multiple_Overlapping(t *testing.T) {
mc := tsdb.MultiCursor(true, mc := tsdb.MultiCursor(tsdb.Forward,
NewCursor(true, []CursorItem{ NewCursor(tsdb.Forward, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0x00}}, {Key: []byte{0x00}, Value: []byte{0x00}},
{Key: []byte{0x03}, Value: []byte{0x03}}, {Key: []byte{0x03}, Value: []byte{0x03}},
{Key: []byte{0x04}, Value: []byte{0x04}}, {Key: []byte{0x04}, Value: []byte{0x04}},
}), }),
NewCursor(true, []CursorItem{ NewCursor(tsdb.Forward, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0xF0}}, {Key: []byte{0x00}, Value: []byte{0xF0}},
{Key: []byte{0x02}, Value: []byte{0xF2}}, {Key: []byte{0x02}, Value: []byte{0xF2}},
{Key: []byte{0x04}, Value: []byte{0xF4}}, {Key: []byte{0x04}, Value: []byte{0xF4}},
@ -142,13 +142,13 @@ func TestMultiCursor_Multiple_Overlapping(t *testing.T) {
// Ensure the multi-cursor can correctly iterate across multiple overlapping subcursors. // Ensure the multi-cursor can correctly iterate across multiple overlapping subcursors.
func TestMultiCursor_Multiple_Overlapping_Reverse(t *testing.T) { func TestMultiCursor_Multiple_Overlapping_Reverse(t *testing.T) {
mc := tsdb.MultiCursor(false, mc := tsdb.MultiCursor(tsdb.Reverse,
NewCursor(false, []CursorItem{ NewCursor(tsdb.Reverse, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0x00}}, {Key: []byte{0x00}, Value: []byte{0x00}},
{Key: []byte{0x03}, Value: []byte{0x03}}, {Key: []byte{0x03}, Value: []byte{0x03}},
{Key: []byte{0x04}, Value: []byte{0x04}}, {Key: []byte{0x04}, Value: []byte{0x04}},
}), }),
NewCursor(false, []CursorItem{ NewCursor(tsdb.Reverse, []CursorItem{
{Key: []byte{0x00}, Value: []byte{0xF0}}, {Key: []byte{0x00}, Value: []byte{0xF0}},
{Key: []byte{0x02}, Value: []byte{0xF2}}, {Key: []byte{0x02}, Value: []byte{0xF2}},
{Key: []byte{0x04}, Value: []byte{0xF4}}, {Key: []byte{0x04}, Value: []byte{0xF4}},
@ -196,7 +196,7 @@ func TestMultiCursor_Quick(t *testing.T) {
sort.Sort(byteSlices(exp)) sort.Sort(byteSlices(exp))
// Create multi-cursor and iterate over all items. // Create multi-cursor and iterate over all items.
mc := tsdb.MultiCursor(true, tsdbCursorSlice(cursors)...) mc := tsdb.MultiCursor(tsdb.Forward, tsdbCursorSlice(cursors)...)
for k, v := mc.Seek(u64tob(seek)); k != nil; k, v = mc.Next() { for k, v := mc.Seek(u64tob(seek)); k != nil; k, v = mc.Next() {
got = append(got, append(k, v...)) got = append(got, append(k, v...))
} }

View File

@ -176,7 +176,7 @@ func TestEngine_WriteIndex_Append(t *testing.T) {
defer tx.Rollback() defer tx.Rollback()
// Iterate over "cpu" series. // Iterate over "cpu" series.
c := tx.Cursor("cpu", true) c := tx.Cursor("cpu", tsdb.Forward)
if k, v := c.Seek(u64tob(0)); !reflect.DeepEqual(k, []byte{0, 0, 0, 0, 0, 0, 0, 1}) || !reflect.DeepEqual(v, []byte{0x10}) { if k, v := c.Seek(u64tob(0)); !reflect.DeepEqual(k, []byte{0, 0, 0, 0, 0, 0, 0, 1}) || !reflect.DeepEqual(v, []byte{0x10}) {
t.Fatalf("unexpected key/value: %x / %x", k, v) t.Fatalf("unexpected key/value: %x / %x", k, v)
} else if k, v = c.Next(); !reflect.DeepEqual(k, []byte{0, 0, 0, 0, 0, 0, 0, 2}) || !reflect.DeepEqual(v, []byte{0x20}) { } else if k, v = c.Next(); !reflect.DeepEqual(k, []byte{0, 0, 0, 0, 0, 0, 0, 2}) || !reflect.DeepEqual(v, []byte{0x20}) {
@ -186,7 +186,7 @@ func TestEngine_WriteIndex_Append(t *testing.T) {
} }
// Iterate over "mem" series. // Iterate over "mem" series.
c = tx.Cursor("mem", true) c = tx.Cursor("mem", tsdb.Forward)
if k, v := c.Seek(u64tob(0)); !reflect.DeepEqual(k, []byte{0, 0, 0, 0, 0, 0, 0, 0}) || !reflect.DeepEqual(v, []byte{0x30}) { if k, v := c.Seek(u64tob(0)); !reflect.DeepEqual(k, []byte{0, 0, 0, 0, 0, 0, 0, 0}) || !reflect.DeepEqual(v, []byte{0x30}) {
t.Fatalf("unexpected key/value: %x / %x", k, v) t.Fatalf("unexpected key/value: %x / %x", k, v)
} else if k, _ = c.Next(); k != nil { } else if k, _ = c.Next(); k != nil {
@ -236,7 +236,7 @@ func TestEngine_WriteIndex_Insert(t *testing.T) {
defer tx.Rollback() defer tx.Rollback()
// Iterate over "cpu" series. // Iterate over "cpu" series.
c := tx.Cursor("cpu", true) c := tx.Cursor("cpu", tsdb.Forward)
if k, v := c.Seek(u64tob(0)); btou64(k) != 9 || !bytes.Equal(v, []byte{0x09}) { if k, v := c.Seek(u64tob(0)); btou64(k) != 9 || !bytes.Equal(v, []byte{0x09}) {
t.Fatalf("unexpected key/value: %x / %x", k, v) t.Fatalf("unexpected key/value: %x / %x", k, v)
} else if k, v = c.Next(); btou64(k) != 10 || !bytes.Equal(v, []byte{0xFF}) { } else if k, v = c.Next(); btou64(k) != 10 || !bytes.Equal(v, []byte{0xFF}) {
@ -294,7 +294,7 @@ func TestEngine_Cursor_Reverse(t *testing.T) {
defer tx.Rollback() defer tx.Rollback()
// Iterate over "cpu" series. // Iterate over "cpu" series.
c := tx.Cursor("cpu", false) c := tx.Cursor("cpu", tsdb.Reverse)
if k, v := c.Seek(u64tob(math.MaxUint64)); btou64(k) != 31 || !bytes.Equal(v, []byte{0xFF}) { if k, v := c.Seek(u64tob(math.MaxUint64)); btou64(k) != 31 || !bytes.Equal(v, []byte{0xFF}) {
t.Fatalf("unexpected key/value: %x / %x", k, v) t.Fatalf("unexpected key/value: %x / %x", k, v)
} else if k, v = c.Next(); btou64(k) != 30 || !bytes.Equal(v, []byte{0x30}) { } else if k, v = c.Next(); btou64(k) != 30 || !bytes.Equal(v, []byte{0x30}) {
@ -335,7 +335,7 @@ func TestEngine_WriteIndex_SeekAgainstInBlockValue(t *testing.T) {
defer tx.Rollback() defer tx.Rollback()
// Ensure that we can seek to a block in the middle // Ensure that we can seek to a block in the middle
c := tx.Cursor("cpu", true) c := tx.Cursor("cpu", tsdb.Forward)
if k, _ := c.Seek(u64tob(15)); btou64(k) != 20 { if k, _ := c.Seek(u64tob(15)); btou64(k) != 20 {
t.Fatalf("expected to seek to time 20, but got %d", btou64(k)) t.Fatalf("expected to seek to time 20, but got %d", btou64(k))
} }
@ -393,7 +393,7 @@ func TestEngine_WriteIndex_Quick(t *testing.T) {
// Iterate over results to ensure they are correct. // Iterate over results to ensure they are correct.
for _, key := range keys { for _, key := range keys {
c := tx.Cursor(key, true) c := tx.Cursor(key, tsdb.Forward)
// Read list of key/values. // Read list of key/values.
var got [][]byte var got [][]byte
@ -440,7 +440,7 @@ func TestEngine_WriteIndex_Quick_Append(t *testing.T) {
// Iterate over results to ensure they are correct. // Iterate over results to ensure they are correct.
for _, key := range keys { for _, key := range keys {
c := tx.Cursor(key, true) c := tx.Cursor(key, tsdb.Forward)
// Read list of key/values. // Read list of key/values.
var got [][]byte var got [][]byte

View File

@ -46,7 +46,7 @@ func TestWAL_WritePoints(t *testing.T) {
} }
verify := func() { verify := func() {
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
k, v := c.Seek(inttob(1)) k, v := c.Seek(inttob(1))
// ensure the series are there and points are in order // ensure the series are there and points are in order
@ -64,7 +64,7 @@ func TestWAL_WritePoints(t *testing.T) {
t.Fatalf("expected nil on last seek: %v %v", k, v) t.Fatalf("expected nil on last seek: %v %v", k, v)
} }
c = log.Cursor("cpu,host=B", true) c = log.Cursor("cpu,host=B", tsdb.Forward)
k, v = c.Next() k, v = c.Next()
if bytes.Compare(v, p3.Data()) != 0 { if bytes.Compare(v, p3.Data()) != 0 {
t.Fatalf("expected to seek to first point but got key and value: %v %v", k, v) t.Fatalf("expected to seek to first point but got key and value: %v %v", k, v)
@ -92,7 +92,7 @@ func TestWAL_WritePoints(t *testing.T) {
} }
verify2 := func() { verify2 := func() {
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
k, v := c.Next() k, v := c.Next()
if bytes.Compare(v, p1.Data()) != 0 { if bytes.Compare(v, p1.Data()) != 0 {
t.Fatalf("order wrong, expected p1, %v %v %v", v, k, p1.Data()) t.Fatalf("order wrong, expected p1, %v %v %v", v, k, p1.Data())
@ -110,7 +110,7 @@ func TestWAL_WritePoints(t *testing.T) {
t.Fatal("order wrong, expected p6") t.Fatal("order wrong, expected p6")
} }
c = log.Cursor("cpu,host=C", true) c = log.Cursor("cpu,host=C", tsdb.Forward)
_, v = c.Next() _, v = c.Next()
if bytes.Compare(v, p5.Data()) != 0 { if bytes.Compare(v, p5.Data()) != 0 {
t.Fatal("order wrong, expected p6") t.Fatal("order wrong, expected p6")
@ -150,7 +150,7 @@ func TestWAL_CorruptDataLengthSize(t *testing.T) {
} }
verify := func() { verify := func() {
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
_, v := c.Next() _, v := c.Next()
if bytes.Compare(v, p1.Data()) != 0 { if bytes.Compare(v, p1.Data()) != 0 {
t.Fatal("p1 value wrong") t.Fatal("p1 value wrong")
@ -183,7 +183,7 @@ func TestWAL_CorruptDataLengthSize(t *testing.T) {
} }
verify = func() { verify = func() {
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
_, v := c.Next() _, v := c.Next()
if bytes.Compare(v, p1.Data()) != 0 { if bytes.Compare(v, p1.Data()) != 0 {
t.Fatal("p1 value wrong") t.Fatal("p1 value wrong")
@ -229,7 +229,7 @@ func TestWAL_CorruptDataBlock(t *testing.T) {
} }
verify := func() { verify := func() {
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
_, v := c.Next() _, v := c.Next()
if bytes.Compare(v, p1.Data()) != 0 { if bytes.Compare(v, p1.Data()) != 0 {
t.Fatal("p1 value wrong") t.Fatal("p1 value wrong")
@ -268,7 +268,7 @@ func TestWAL_CorruptDataBlock(t *testing.T) {
} }
verify = func() { verify = func() {
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
_, v := c.Next() _, v := c.Next()
if bytes.Compare(v, p1.Data()) != 0 { if bytes.Compare(v, p1.Data()) != 0 {
t.Fatal("p1 value wrong") t.Fatal("p1 value wrong")
@ -349,7 +349,7 @@ func TestWAL_CompactAfterPercentageThreshold(t *testing.T) {
} }
// ensure we have some data // ensure we have some data
c := log.Cursor("cpu,host=A,region=uswest23", true) c := log.Cursor("cpu,host=A,region=uswest23", tsdb.Forward)
k, v := c.Next() k, v := c.Next()
if btou64(k) != 1 { if btou64(k) != 1 {
t.Fatalf("expected timestamp of 1, but got %v %v", k, v) t.Fatalf("expected timestamp of 1, but got %v %v", k, v)
@ -365,13 +365,13 @@ func TestWAL_CompactAfterPercentageThreshold(t *testing.T) {
} }
// should be nil // should be nil
c = log.Cursor("cpu,host=A,region=uswest23", true) c = log.Cursor("cpu,host=A,region=uswest23", tsdb.Forward)
k, v = c.Next() k, v = c.Next()
if k != nil || v != nil { if k != nil || v != nil {
t.Fatal("expected cache to be nil after flush: ", k, v) t.Fatal("expected cache to be nil after flush: ", k, v)
} }
c = log.Cursor("cpu,host=A,region=useast1", true) c = log.Cursor("cpu,host=A,region=useast1", tsdb.Forward)
k, v = c.Next() k, v = c.Next()
if btou64(k) != 1 { if btou64(k) != 1 {
t.Fatal("expected cache to be there after flush and compact: ", k, v) t.Fatal("expected cache to be there after flush and compact: ", k, v)
@ -385,13 +385,13 @@ func TestWAL_CompactAfterPercentageThreshold(t *testing.T) {
log.Close() log.Close()
log.Open() log.Open()
c = log.Cursor("cpu,host=A,region=uswest23", true) c = log.Cursor("cpu,host=A,region=uswest23", tsdb.Forward)
k, v = c.Next() k, v = c.Next()
if k != nil || v != nil { if k != nil || v != nil {
t.Fatal("expected cache to be nil after flush and re-open: ", k, v) t.Fatal("expected cache to be nil after flush and re-open: ", k, v)
} }
c = log.Cursor("cpu,host=A,region=useast1", true) c = log.Cursor("cpu,host=A,region=useast1", tsdb.Forward)
k, v = c.Next() k, v = c.Next()
if btou64(k) != 1 { if btou64(k) != 1 {
t.Fatal("expected cache to be there after flush and compact: ", k, v) t.Fatal("expected cache to be there after flush and compact: ", k, v)
@ -444,7 +444,7 @@ func TestWAL_CompactAfterTimeWithoutWrite(t *testing.T) {
} }
// ensure we have some data // ensure we have some data
c := log.Cursor("cpu,host=A,region=uswest10", true) c := log.Cursor("cpu,host=A,region=uswest10", tsdb.Forward)
k, _ := c.Next() k, _ := c.Next()
if btou64(k) != 1 { if btou64(k) != 1 {
t.Fatalf("expected first data point but got one with key: %v", k) t.Fatalf("expected first data point but got one with key: %v", k)
@ -625,12 +625,12 @@ func TestWAL_DeleteSeries(t *testing.T) {
} }
// ensure data is there // ensure data is there
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
if k, _ := c.Next(); btou64(k) != 1 { if k, _ := c.Next(); btou64(k) != 1 {
t.Fatal("expected data point for cpu,host=A") t.Fatal("expected data point for cpu,host=A")
} }
c = log.Cursor("cpu,host=B", true) c = log.Cursor("cpu,host=B", tsdb.Forward)
if k, _ := c.Next(); btou64(k) != 2 { if k, _ := c.Next(); btou64(k) != 2 {
t.Fatal("expected data point for cpu,host=B") t.Fatal("expected data point for cpu,host=B")
} }
@ -641,13 +641,13 @@ func TestWAL_DeleteSeries(t *testing.T) {
} }
// ensure data is there // ensure data is there
c = log.Cursor("cpu,host=A", true) c = log.Cursor("cpu,host=A", tsdb.Forward)
if k, _ := c.Next(); btou64(k) != 1 { if k, _ := c.Next(); btou64(k) != 1 {
t.Fatal("expected data point for cpu,host=A") t.Fatal("expected data point for cpu,host=A")
} }
// ensure series is deleted // ensure series is deleted
c = log.Cursor("cpu,host=B", true) c = log.Cursor("cpu,host=B", tsdb.Forward)
if k, _ := c.Next(); k != nil { if k, _ := c.Next(); k != nil {
t.Fatal("expected no data for cpu,host=B") t.Fatal("expected no data for cpu,host=B")
} }
@ -675,13 +675,13 @@ func TestWAL_DeleteSeries(t *testing.T) {
} }
// ensure data is there // ensure data is there
c = log.Cursor("cpu,host=A", true) c = log.Cursor("cpu,host=A", tsdb.Forward)
if k, _ := c.Next(); btou64(k) != 1 { if k, _ := c.Next(); btou64(k) != 1 {
t.Fatal("expected data point for cpu,host=A") t.Fatal("expected data point for cpu,host=A")
} }
// ensure series is deleted // ensure series is deleted
c = log.Cursor("cpu,host=B", true) c = log.Cursor("cpu,host=B", tsdb.Forward)
if k, _ := c.Next(); k != nil { if k, _ := c.Next(); k != nil {
t.Fatal("expected no data for cpu,host=B") t.Fatal("expected no data for cpu,host=B")
} }
@ -805,7 +805,7 @@ func TestWAL_QueryDuringCompaction(t *testing.T) {
} }
verify := func() { verify := func() {
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
k, v := c.Seek(inttob(1)) k, v := c.Seek(inttob(1))
// ensure the series are there and points are in order // ensure the series are there and points are in order
if bytes.Compare(v, p1.Data()) != 0 { if bytes.Compare(v, p1.Data()) != 0 {
@ -851,7 +851,7 @@ func TestWAL_PointsSorted(t *testing.T) {
t.Fatalf("failed to write points: %s", err.Error()) t.Fatalf("failed to write points: %s", err.Error())
} }
c := log.Cursor("cpu,host=A", true) c := log.Cursor("cpu,host=A", tsdb.Forward)
k, _ := c.Next() k, _ := c.Next()
if btou64(k) != 1 { if btou64(k) != 1 {
t.Fatal("points out of order") t.Fatal("points out of order")
@ -896,7 +896,7 @@ func TestWAL_Cursor_Reverse(t *testing.T) {
t.Fatalf("failed to write points: %s", err.Error()) t.Fatalf("failed to write points: %s", err.Error())
} }
c := log.Cursor("cpu,host=A", false) c := log.Cursor("cpu,host=A", tsdb.Reverse)
k, _ := c.Next() k, _ := c.Next()
if btou64(k) != 6 { if btou64(k) != 6 {
t.Fatal("points out of order") t.Fatal("points out of order")