fixing tests that were affected by the messenger/view merge

This commit is contained in:
Travis 2017-04-06 14:28:45 -05:00
parent 13e08ac3a5
commit cebca697b1
4 changed files with 13 additions and 13 deletions

View file

@ -106,6 +106,8 @@ data-dir = "` + actualDataDir + `"
// confirm log file was written
info, err := logFile.Stat()
if err != nil || info.Size() == 0 {
// NOTE: this test assumes that something is being written to the log
// currently, that is relying on log: "index sync monitor initializing"
return errors.New("Log file was not written!")
}
return nil

View file

@ -288,7 +288,7 @@ func TestFragment_TopN_CacheSize(t *testing.T) {
file.Close()
f := &Fragment{
Fragment: pilosa.NewFragment(file.Name(), "d", "f.n", slice, cacheLimit),
Fragment: pilosa.NewFragment(file.Name(), "d", "f.n", pilosa.ViewStandard, slice, cacheLimit),
BitmapAttrStore: MustOpenAttrStore(),
}
f.Fragment.BitmapAttrStore = f.BitmapAttrStore.AttrStore
@ -308,15 +308,15 @@ func TestFragment_TopN_CacheSize(t *testing.T) {
f.RecalculateCache()
p := []pilosa.Pair{
{Key: 104, Count: 7},
{Key: 103, Count: 6}}
{ID: 104, Count: 7},
{ID: 103, Count: 6}}
// Retrieve top bitmaps.
if pairs, err := f.Top(pilosa.TopOptions{N: 5}); err != nil {
t.Fatal(err)
} else if len(pairs) > cacheLimit {
t.Fatalf("TopN count cannot exceed cache size: %d", cacheLimit)
} else if pairs[0] != (pilosa.Pair{Key: 104, Count: 7}) {
} else if pairs[0] != (pilosa.Pair{ID: 104, Count: 7}) {
t.Fatalf("unexpected pair(0): %v", pairs)
} else if !reflect.DeepEqual(pairs, p) {
t.Fatalf("Invalid TopN result set: %s", spew.Sdump(pairs))
@ -572,7 +572,7 @@ func BenchmarkFragment_Blocks(b *testing.B) {
}
// Open the fragment specified by the path.
f := pilosa.NewFragment(*FragmentPath, "d", "f", pilosa.ViewStandard, 0, pilosa.DefaultFrameCache)
f := pilosa.NewFragment(*FragmentPath, "d", "f", pilosa.ViewStandard, 0, pilosa.DefaultCacheSize)
if err := f.Open(); err != nil {
b.Fatal(err)
}
@ -633,7 +633,7 @@ func NewFragment(db, frame, view string, slice uint64) *Fragment {
file.Close()
f := &Fragment{
Fragment: pilosa.NewFragment(file.Name(), db, frame, view, slice, pilosa.DefaultFrameCache),
Fragment: pilosa.NewFragment(file.Name(), db, frame, view, slice, pilosa.DefaultCacheSize),
BitmapAttrStore: MustOpenAttrStore(),
}
f.Fragment.BitmapAttrStore = f.BitmapAttrStore.AttrStore
@ -664,7 +664,7 @@ func (f *Fragment) Reopen() error {
return err
}
f.Fragment = pilosa.NewFragment(path, f.DB(), f.Frame(), f.View(), f.Slice(), pilosa.DefaultFrameCache)
f.Fragment = pilosa.NewFragment(path, f.DB(), f.Frame(), f.View(), f.Slice(), pilosa.DefaultCacheSize)
f.Fragment.BitmapAttrStore = f.BitmapAttrStore.AttrStore
if err := f.Open(); err != nil {
return err

View file

@ -428,7 +428,7 @@ func (f *Frame) CreateViewIfNotExists(name string) (*View, error) {
}
func (f *Frame) newView(path, name string) *View {
view := NewView(path, f.db, f.name, name)
view := NewView(path, f.db, f.name, name, f.cacheSize)
view.cacheType = f.cacheType
view.LogOutput = f.LogOutput
view.BitmapAttrStore = f.bitmapAttrStore

View file

@ -120,11 +120,9 @@ func (s *Server) Open() error {
go func() { http.Serve(ln, s.Handler) }()
// Start background monitoring.
/*
s.wg.Add(2)
go func() { defer s.wg.Done(); s.monitorAntiEntropy() }()
go func() { defer s.wg.Done(); s.monitorMaxSlices() }()
*/
s.wg.Add(2)
go func() { defer s.wg.Done(); s.monitorAntiEntropy() }()
go func() { defer s.wg.Done(); s.monitorMaxSlices() }()
return nil
}