diff --git a/holder.go b/holder.go index 22289e4a8..59fef1560 100644 --- a/holder.go +++ b/holder.go @@ -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 { diff --git a/index_test.go b/index_test.go index 1e3df2b35..43a064967 100644 --- a/index_test.go +++ b/index_test.go @@ -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) + } +}