check range with CacheTypeNone

This commit is contained in:
Linh Vo 2017-07-21 13:28:20 -05:00
parent 2cfcf497e1
commit 4aa487daac
2 changed files with 13 additions and 2 deletions

View file

@ -394,10 +394,9 @@ func (i *Index) createFrame(name string, opt FrameOptions) (*Frame, error) {
if opt.RangeEnabled {
if opt.InverseEnabled {
return nil, ErrInverseRangeNotAllowed
} else if opt.CacheType != "" && opt.CacheType != CacheTypeLRU {
} else if opt.CacheType != "" && opt.CacheType != CacheTypeNone {
return nil, ErrRangeCacheNotAllowed
}
opt.CacheSize = 0
} else {
if len(opt.Fields) > 0 {
return nil, ErrFrameFieldsNotAllowed

View file

@ -149,6 +149,18 @@ func TestIndex_CreateFrame(t *testing.T) {
}
})
t.Run("RangeEnabledWithCacheTypeNone", func(t *testing.T) {
index := test.MustOpenIndex()
defer index.Close()
if _, err := index.CreateFrame("f", pilosa.FrameOptions{
RangeEnabled: true,
CacheType: pilosa.CacheTypeNone,
CacheSize: uint32(5),
}); err != nil {
t.Fatal(err)
}
})
t.Run("ErrFrameFieldsNotAllowed", func(t *testing.T) {
index := test.MustOpenIndex()
defer index.Close()