7159: Fix error handling when reading full size block. refs #7159
[arvados.git] / services / keepstore / bufferpool_test.go
index b2f63b1abbd04dd24993d5ba1a151d8af3034fe3..8726a19150c7faf2f309cc6b3ba647d9aa40dd54 100644 (file)
@@ -10,13 +10,20 @@ import (
 func TestBufferPool(t *testing.T) {
        TestingT(t)
 }
+
 var _ = Suite(&BufferPoolSuite{})
-type BufferPoolSuite struct {}
+
+type BufferPoolSuite struct{}
 
 // Initialize a default-sized buffer pool for the benefit of test
 // suites that don't run main().
 func init() {
-       bufs = newBufferPool(maxBuffers, BLOCKSIZE)
+       bufs = newBufferPool(maxBuffers, BlockSize)
+}
+
+// Restore sane default after bufferpool's own tests
+func (s *BufferPoolSuite) TearDownTest(c *C) {
+       bufs = newBufferPool(maxBuffers, BlockSize)
 }
 
 func (s *BufferPoolSuite) TestBufferPoolBufSize(c *C) {
@@ -50,7 +57,7 @@ func testBufferPoolRace(c *C, bufs *bufferPool, unused []byte, expectWin string)
                race <- "Get"
        }()
        go func() {
-               time.Sleep(10*time.Millisecond)
+               time.Sleep(10 * time.Millisecond)
                bufs.Put(unused)
                race <- "Put"
        }()
@@ -81,5 +88,5 @@ func (s *BufferPoolSuite) TestBufferPoolReuse(c *C) {
                }
                last = next
        }
-       c.Check(reuses > allocs * 95/100, Equals, true)
+       c.Check(reuses > allocs*95/100, Equals, true)
 }