mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
test two scenarios
This commit is contained in:
parent
3ca91bba7f
commit
2bc2640fbf
1 changed files with 37 additions and 0 deletions
37
api_test.go
37
api_test.go
|
|
@ -251,6 +251,43 @@ func TestAPI_ImportValue(t *testing.T) {
|
|||
}
|
||||
})
|
||||
|
||||
t.Run("ValIntEmpty", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
index := "valintempty"
|
||||
field := "f"
|
||||
|
||||
_, err := coord.API.CreateIndex(ctx, index, pilosa.IndexOptions{Keys: true})
|
||||
if err != nil {
|
||||
t.Fatalf("creating index: %v", err)
|
||||
}
|
||||
_, err = coord.API.CreateField(ctx, index, field, pilosa.OptFieldTypeInt(math.MinInt64, math.MaxInt64))
|
||||
if err != nil {
|
||||
t.Fatalf("creating field: %v", err)
|
||||
}
|
||||
|
||||
// Column keys are sharded so their order is not guaranteed.
|
||||
colKeys := []string{"col2", "col1", "col3"}
|
||||
|
||||
// Import without data, verify that it succeeds
|
||||
req := &pilosa.ImportValueRequest{
|
||||
Index: index,
|
||||
Field: field,
|
||||
}
|
||||
qcx1 := coord.API.Txf().NewQcx()
|
||||
if err := coord.API.ImportValue(ctx, qcx1, req); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
PanicOn(qcx1.Finish())
|
||||
|
||||
// Import without data but with columnkeys, verify that it errors
|
||||
req.ColumnKeys = colKeys
|
||||
qcx2 := coord.API.Txf().NewQcx()
|
||||
if err := coord.API.ImportValue(ctx, qcx2, req); err == nil {
|
||||
t.Fatal("expected error but succeeded")
|
||||
}
|
||||
PanicOn(qcx2.Finish())
|
||||
})
|
||||
|
||||
t.Run("ValDecimalField", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
index := "valdec"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue