mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Test for presence of column attrs
This commit is contained in:
parent
628def3db7
commit
c3e8284f6c
1 changed files with 17 additions and 10 deletions
27
api_test.go
27
api_test.go
|
|
@ -65,7 +65,7 @@ func TestAPI_ImportColumnAttrs(t *testing.T) {
|
|||
ctx := context.Background()
|
||||
index := "i"
|
||||
field := "f"
|
||||
attrKey := "columnid-md5"
|
||||
attrKey := "k"
|
||||
|
||||
_, err := m0.API.CreateIndex(ctx, index, pilosa.IndexOptions{})
|
||||
if err != nil {
|
||||
|
|
@ -77,20 +77,21 @@ func TestAPI_ImportColumnAttrs(t *testing.T) {
|
|||
}
|
||||
|
||||
// Generate some attrs for two shards
|
||||
columnIDs0 := make([]uint64, 0, 100)
|
||||
attrVals0 := make([]string, 0, 100)
|
||||
columnIDs1 := make([]uint64, 0, 100)
|
||||
attrVals1 := make([]string, 0, 100)
|
||||
for n := 0; n < 1000000; n += 10000 {
|
||||
numAttrs := 100
|
||||
columnIDs0 := make([]uint64, 0, numAttrs)
|
||||
attrVals0 := make([]string, 0, numAttrs)
|
||||
columnIDs1 := make([]uint64, 0, numAttrs)
|
||||
attrVals1 := make([]string, 0, numAttrs)
|
||||
for n := 0; n < 1000000; n += 1000000 / numAttrs {
|
||||
columnIDs0 = append(columnIDs0, uint64(n))
|
||||
md50 := attrFun(uint64(n))
|
||||
attrVals0 = append(attrVals0, md50)
|
||||
val0 := attrFun(uint64(n))
|
||||
attrVals0 = append(attrVals0, val0)
|
||||
setPql0 := fmt.Sprintf("Set(%d, %s=0) ", n, field)
|
||||
m0.API.Query(ctx, &pilosa.QueryRequest{Index: index, Query: setPql0})
|
||||
|
||||
columnIDs1 = append(columnIDs1, uint64(n+ShardWidth))
|
||||
md51 := attrFun(uint64(n + ShardWidth))
|
||||
attrVals1 = append(attrVals1, md51)
|
||||
val1 := attrFun(uint64(n + ShardWidth))
|
||||
attrVals1 = append(attrVals1, val1)
|
||||
setPql1 := fmt.Sprintf("Set(%d, %s=0) ", n+ShardWidth, field)
|
||||
m1.API.Query(ctx, &pilosa.QueryRequest{Index: index, Query: setPql1})
|
||||
}
|
||||
|
|
@ -127,6 +128,9 @@ func TestAPI_ImportColumnAttrs(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(res.ColumnAttrSets) != 100 {
|
||||
t.Fatal("incorrect number of column attrs set")
|
||||
}
|
||||
|
||||
for _, v := range res.ColumnAttrSets {
|
||||
attrVal := attrFun(v.ID)
|
||||
|
|
@ -140,6 +144,9 @@ func TestAPI_ImportColumnAttrs(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(res.ColumnAttrSets) != 100 {
|
||||
t.Fatal("incorrect number of column attrs set")
|
||||
}
|
||||
|
||||
for _, v := range res.ColumnAttrSets {
|
||||
attrVal := attrFun(v.ID)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue