swarm: CI race detector test adjustments (#19017)

This commit is contained in:
Ferenc Szabo
2019-02-08 17:07:11 +01:00
committed by Anton Evangelatov
parent cde02e017e
commit 27e3f96819
6 changed files with 60 additions and 84 deletions

View File

@ -83,7 +83,7 @@ func newLDBStore(t *testing.T) (*LDBStore, func()) {
return db, cleanup
}
func mputRandomChunks(store ChunkStore, n int, chunksize int64) ([]Chunk, error) {
func mputRandomChunks(store ChunkStore, n int) ([]Chunk, error) {
return mput(store, n, GenerateRandomChunk)
}
@ -91,7 +91,7 @@ func mput(store ChunkStore, n int, f func(i int64) Chunk) (hs []Chunk, err error
// put to localstore and wait for stored channel
// does not check delivery error state
errc := make(chan error)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
for i := int64(0); i < int64(n); i++ {
chunk := f(ch.DefaultSize)
@ -159,8 +159,8 @@ func (r *brokenLimitedReader) Read(buf []byte) (int, error) {
return r.lr.Read(buf)
}
func testStoreRandom(m ChunkStore, n int, chunksize int64, t *testing.T) {
chunks, err := mputRandomChunks(m, n, chunksize)
func testStoreRandom(m ChunkStore, n int, t *testing.T) {
chunks, err := mputRandomChunks(m, n)
if err != nil {
t.Fatalf("expected no error, got %v", err)
}
@ -170,8 +170,8 @@ func testStoreRandom(m ChunkStore, n int, chunksize int64, t *testing.T) {
}
}
func testStoreCorrect(m ChunkStore, n int, chunksize int64, t *testing.T) {
chunks, err := mputRandomChunks(m, n, chunksize)
func testStoreCorrect(m ChunkStore, n int, t *testing.T) {
chunks, err := mputRandomChunks(m, n)
if err != nil {
t.Fatalf("expected no error, got %v", err)
}
@ -195,7 +195,7 @@ func testStoreCorrect(m ChunkStore, n int, chunksize int64, t *testing.T) {
}
}
func benchmarkStorePut(store ChunkStore, n int, chunksize int64, b *testing.B) {
func benchmarkStorePut(store ChunkStore, n int, b *testing.B) {
chunks := make([]Chunk, n)
i := 0
f := func(dataSize int64) Chunk {
@ -222,8 +222,8 @@ func benchmarkStorePut(store ChunkStore, n int, chunksize int64, b *testing.B) {
}
}
func benchmarkStoreGet(store ChunkStore, n int, chunksize int64, b *testing.B) {
chunks, err := mputRandomChunks(store, n, chunksize)
func benchmarkStoreGet(store ChunkStore, n int, b *testing.B) {
chunks, err := mputRandomChunks(store, n)
if err != nil {
b.Fatalf("expected no error, got %v", err)
}