76fdb5d863
Currently storage tests were tied to the default lookup limit. By increasing the limits, the tests will take longer and sometimes cause a large number of goroutines to be started. This change adds configurable lookup limit to all storage backends. Also remove boltdb.NewShared, since it's not used any more. Change-Id: I1a052f149da471246fac5745da133c3cfc27582e
49 lines
844 B
Go
49 lines
844 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package redis
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"storj.io/storj/storage/redis/redisserver"
|
|
"storj.io/storj/storage/testsuite"
|
|
)
|
|
|
|
func TestSuite(t *testing.T) {
|
|
addr, cleanup, err := redisserver.Start()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer cleanup()
|
|
|
|
client, err := NewClient(addr, "", 1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
client.SetLookupLimit(500)
|
|
testsuite.RunTests(t, client)
|
|
}
|
|
|
|
func TestInvalidConnection(t *testing.T) {
|
|
_, err := NewClient("", "", 1)
|
|
if err == nil {
|
|
t.Fatal("expected connection error")
|
|
}
|
|
}
|
|
|
|
func BenchmarkSuite(b *testing.B) {
|
|
addr, cleanup, err := redisserver.Start()
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
defer cleanup()
|
|
|
|
client, err := NewClient(addr, "", 1)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
testsuite.RunBenchmarks(b, client)
|
|
}
|