mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 23:51:03 +00:00
CreateInputDefinition tests
This commit is contained in:
parent
ea53216ff2
commit
5ce6b5d684
2 changed files with 29 additions and 1 deletions
|
|
@ -96,7 +96,6 @@ func (h *Holder) Open() error {
|
|||
|
||||
index, err := h.newIndex(h.IndexPath(filepath.Base(fi.Name())), filepath.Base(fi.Name()))
|
||||
if err == ErrName {
|
||||
|
||||
h.logger().Printf("ERROR opening index: %s, err=%s", fi.Name(), err)
|
||||
continue
|
||||
} else if err != nil {
|
||||
|
|
|
|||
|
|
@ -258,3 +258,32 @@ func TestIndex_CreateInputDefinition(t *testing.T) {
|
|||
t.Fatalf("unexpected input definition actions", inputDef.Fields())
|
||||
}
|
||||
}
|
||||
|
||||
func TestIndex_CreateExistingInputDefinition(t *testing.T) {
|
||||
index := MustOpenIndex()
|
||||
defer index.Close()
|
||||
|
||||
// Create Input Definition.
|
||||
frames := pilosa.InputFrame{Name: "f", Options: pilosa.FrameOptions{RowLabel: "row"}}
|
||||
action := pilosa.Action{Frame: "f", ValueDestination: "map", ValueMap: map[string]uint64{"Green": 1}}
|
||||
fields := pilosa.Field{Name: "id", PrimaryKey: true, Actions: []pilosa.Action{action}}
|
||||
_ , err := index.CreateInputDefinition("test", []pilosa.InputFrame{frames}, []pilosa.Field{fields})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = index.CreateInputDefinition("test", []pilosa.InputFrame{frames}, []pilosa.Field{fields})
|
||||
if err != pilosa.ErrInputDefinitionExists {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIndex_CreateEmptyInputDefinition(t *testing.T) {
|
||||
index := MustOpenIndex()
|
||||
defer index.Close()
|
||||
|
||||
// Create Input Definition.
|
||||
_ , err := index.CreateInputDefinition("test", []pilosa.InputFrame{}, []pilosa.Field{})
|
||||
if err.Error() != "frames and fields are required" {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue