use a helper function
This commit is contained in:
parent
d4af5388a9
commit
90ceeacda3
@ -21,42 +21,29 @@ import (
|
|||||||
"github.com/google/cadvisor/storage/test"
|
"github.com/google/cadvisor/storage/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMaxMemoryUsage(t *testing.T) {
|
func runStorageTest(f func(storage.StorageDriver, *testing.T), t *testing.T) {
|
||||||
maxSize := 200
|
maxSize := 200
|
||||||
|
|
||||||
var driver storage.StorageDriver
|
var driver storage.StorageDriver
|
||||||
for N := 10; N < maxSize; N += 10 {
|
for N := 10; N < maxSize; N += 10 {
|
||||||
driver = New(N, N)
|
driver = New(N, N)
|
||||||
test.StorageDriverTestMaxMemoryUsage(driver, t)
|
f(driver, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMaxMemoryUsage(t *testing.T) {
|
||||||
|
runStorageTest(test.StorageDriverTestMaxMemoryUsage, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSampleCpuUsage(t *testing.T) {
|
func TestSampleCpuUsage(t *testing.T) {
|
||||||
maxSize := 200
|
runStorageTest(test.StorageDriverTestSampleCpuUsage, t)
|
||||||
|
|
||||||
var driver storage.StorageDriver
|
|
||||||
for N := 10; N < maxSize; N += 10 {
|
|
||||||
driver = New(N, N)
|
|
||||||
test.StorageDriverTestSampleCpuUsage(driver, t)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSamplesWithoutSample(t *testing.T) {
|
func TestSamplesWithoutSample(t *testing.T) {
|
||||||
maxSize := 200
|
runStorageTest(test.StorageDriverTestSamplesWithoutSample, t)
|
||||||
|
|
||||||
var driver storage.StorageDriver
|
|
||||||
for N := 10; N < maxSize; N += 10 {
|
|
||||||
driver = New(N, N)
|
|
||||||
test.StorageDriverTestSamplesWithoutSample(driver, t)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPercentilessWithoutSample(t *testing.T) {
|
func TestPercentilessWithoutSample(t *testing.T) {
|
||||||
maxSize := 200
|
runStorageTest(test.StorageDriverTestPercentilesWithoutSample, t)
|
||||||
|
|
||||||
var driver storage.StorageDriver
|
|
||||||
for N := 10; N < maxSize; N += 10 {
|
|
||||||
driver = New(N, N)
|
|
||||||
test.StorageDriverTestPercentilesWithoutSample(driver, t)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user