2014-10-21 22:02:20 +00:00
|
|
|
package inmemory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-08-24 11:18:39 +00:00
|
|
|
storagedriver "github.com/distribution/distribution/v3/registry/storage/driver"
|
|
|
|
"github.com/distribution/distribution/v3/registry/storage/driver/testsuites"
|
2023-12-07 18:00:27 +00:00
|
|
|
"github.com/stretchr/testify/suite"
|
2014-10-21 22:02:20 +00:00
|
|
|
)
|
|
|
|
|
2023-12-07 18:00:27 +00:00
|
|
|
func newDriverSuite() *testsuites.DriverSuite {
|
2014-10-21 22:02:20 +00:00
|
|
|
inmemoryDriverConstructor := func() (storagedriver.StorageDriver, error) {
|
2014-10-29 01:15:40 +00:00
|
|
|
return New(), nil
|
2014-10-21 22:02:20 +00:00
|
|
|
}
|
2023-12-07 18:00:27 +00:00
|
|
|
return testsuites.NewDriverSuite(inmemoryDriverConstructor, testsuites.NeverSkip)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestInMemoryDriverSuite(t *testing.T) {
|
|
|
|
suite.Run(t, newDriverSuite())
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkInMemoryDriverSuite(b *testing.B) {
|
|
|
|
benchsuite := testsuites.NewDriverBenchmarkSuite(newDriverSuite())
|
|
|
|
benchsuite.Suite.SetupSuite()
|
|
|
|
b.Cleanup(benchsuite.Suite.TearDownSuite)
|
|
|
|
|
|
|
|
b.Run("PutGetEmptyFiles", benchsuite.BenchmarkPutGetEmptyFiles)
|
|
|
|
b.Run("PutGet1KBFiles", benchsuite.BenchmarkPutGet1KBFiles)
|
|
|
|
b.Run("PutGet1MBFiles", benchsuite.BenchmarkPutGet1MBFiles)
|
|
|
|
b.Run("PutGet1GBFiles", benchsuite.BenchmarkPutGet1GBFiles)
|
|
|
|
b.Run("StreamEmptyFiles", benchsuite.BenchmarkStreamEmptyFiles)
|
|
|
|
b.Run("Stream1KBFiles", benchsuite.BenchmarkStream1KBFiles)
|
|
|
|
b.Run("Stream1MBFiles", benchsuite.BenchmarkStream1MBFiles)
|
|
|
|
b.Run("Stream1GBFiles", benchsuite.BenchmarkStream1GBFiles)
|
|
|
|
b.Run("List5Files", benchsuite.BenchmarkList5Files)
|
|
|
|
b.Run("List50Files", benchsuite.BenchmarkList50Files)
|
|
|
|
b.Run("Delete5Files", benchsuite.BenchmarkDelete5Files)
|
|
|
|
b.Run("Delete50Files", benchsuite.BenchmarkDelete50Files)
|
2014-10-21 22:02:20 +00:00
|
|
|
}
|