projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
5824: Merge branch 'master' into 5824-go-sdk
[arvados.git]
/
services
/
keepstore
/
bufferpool_test.go
diff --git
a/services/keepstore/bufferpool_test.go
b/services/keepstore/bufferpool_test.go
index b2f63b1abbd04dd24993d5ba1a151d8af3034fe3..95d118e221de6b8516654f8a133b871da00c5cd2 100644
(file)
--- a/
services/keepstore/bufferpool_test.go
+++ b/
services/keepstore/bufferpool_test.go
@@
-10,8
+10,10
@@
import (
func TestBufferPool(t *testing.T) {
TestingT(t)
}
func TestBufferPool(t *testing.T) {
TestingT(t)
}
+
var _ = Suite(&BufferPoolSuite{})
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().
// Initialize a default-sized buffer pool for the benefit of test
// suites that don't run main().
@@
-19,6
+21,11
@@
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) {
bufs := newBufferPool(2, 10)
b1 := bufs.Get(1)
func (s *BufferPoolSuite) TestBufferPoolBufSize(c *C) {
bufs := newBufferPool(2, 10)
b1 := bufs.Get(1)
@@
-50,7
+57,7
@@
func testBufferPoolRace(c *C, bufs *bufferPool, unused []byte, expectWin string)
race <- "Get"
}()
go func() {
race <- "Get"
}()
go func() {
- time.Sleep(10
*
time.Millisecond)
+ time.Sleep(10
*
time.Millisecond)
bufs.Put(unused)
race <- "Put"
}()
bufs.Put(unused)
race <- "Put"
}()
@@
-81,5
+88,5
@@
func (s *BufferPoolSuite) TestBufferPoolReuse(c *C) {
}
last = next
}
}
last = next
}
- c.Check(reuses > allocs
*
95/100, Equals, true)
+ c.Check(reuses > allocs
*
95/100, Equals, true)
}
}