Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
fix TestExcludeAttrsBits
Browse files Browse the repository at this point in the history
  • Loading branch information
yuce committed Sep 11, 2017
1 parent ccfd86e commit 1863dfd
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions client_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -828,19 +828,27 @@ func TestRangeFrame(t *testing.T) {

func TestExcludeAttrsBits(t *testing.T) {
client := getClient()
frame, _ := index.Frame("excludebitsattrsframe", nil)
err := client.EnsureFrame(frame)
if err != nil {
t.Fatal(err)
}
attrs := map[string]interface{}{
"foo": "bar",
}
_, err := client.Query(index.BatchQuery(
testFrame.SetBit(1, 100),
testFrame.SetRowAttrs(1, attrs),
_, err = client.Query(index.BatchQuery(
frame.SetBit(1, 100),
frame.SetRowAttrs(1, attrs),
), nil)
if err != nil {
t.Fatal(err)
}

// test exclude bits.
resp, err = client.Query(testFrame.Bitmap(1), &QueryOptions{ExcludeBits: true})
resp, err := client.Query(frame.Bitmap(1), &QueryOptions{ExcludeBits: true})
if err != nil {
t.Fatal(err)
}
if len(resp.Result().Bitmap.Bits) != 0 {
t.Fatalf("bits should be excluded")
}
Expand All @@ -849,7 +857,10 @@ func TestExcludeAttrsBits(t *testing.T) {
}

// test exclude attributes.
resp, err := client.Query(testFrame.Bitmap(1), &QueryOptions{ExcludeAttrs: true})
resp, err = client.Query(frame.Bitmap(1), &QueryOptions{ExcludeAttrs: true})
if err != nil {
t.Fatal(err)
}
if len(resp.Result().Bitmap.Bits) != 1 {
t.Fatalf("bits should be included")
}
Expand Down

0 comments on commit 1863dfd

Please sign in to comment.