no curry
This commit is contained in:
parent
562a150592
commit
41dcf6d42d
@ -25,8 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func runStorageTest(f func(storage.StorageDriver, *testing.T), t *testing.T) {
|
||||
// randomly generate a machine name to mimic multi-machine senario.
|
||||
machineName := "machine-A"
|
||||
machineName := "machineA"
|
||||
tablename := "t"
|
||||
database := "cadvisor"
|
||||
username := "root"
|
||||
@ -65,7 +64,7 @@ func runStorageTest(f func(storage.StorageDriver, *testing.T), t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// generate another container's data on same machine.
|
||||
test.StorageDriverFillRandomStatsFunc("containerOnSameMachine", 100)(driver, t)
|
||||
test.StorageDriverFillRandomStatsFunc("containerOnSameMachine", 100, driver, t)
|
||||
|
||||
// generate another container's data on another machine.
|
||||
driverForAnotherMachine, err := New("machineB",
|
||||
@ -80,7 +79,7 @@ func runStorageTest(f func(storage.StorageDriver, *testing.T), t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer driverForAnotherMachine.Close()
|
||||
test.StorageDriverFillRandomStatsFunc("containerOnAnotherMachine", 100)(driverForAnotherMachine, t)
|
||||
test.StorageDriverFillRandomStatsFunc("containerOnAnotherMachine", 100, driverForAnotherMachine, t)
|
||||
f(driver, t)
|
||||
}
|
||||
|
||||
@ -105,6 +104,5 @@ func TestNoRecentStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNoSamples(t *testing.T) {
|
||||
runStorageTest(test.StorageDriverFillRandomStatsFunc("otherContainer", 100), t)
|
||||
runStorageTest(test.StorageDriverTestNoSamples, t)
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ func samplesInTrace(samples []*info.ContainerStatsSample, cpuTrace, memTrace []u
|
||||
}
|
||||
}
|
||||
|
||||
// This function returns a function that will generate random stats and write
|
||||
// them into the storage. The returned function will not close the driver of
|
||||
// the call, which could be served as a building block to do other works
|
||||
// This function will generate random stats and write
|
||||
// them into the storage. The function will not close the driver
|
||||
func StorageDriverFillRandomStatsFunc(
|
||||
containerName string,
|
||||
N int,
|
||||
) func(driver storage.StorageDriver, t *testing.T) {
|
||||
return func(driver storage.StorageDriver, t *testing.T) {
|
||||
driver storage.StorageDriver,
|
||||
t *testing.T,
|
||||
) {
|
||||
cpuTrace := make([]uint64, 0, N)
|
||||
memTrace := make([]uint64, 0, N)
|
||||
|
||||
@ -115,7 +115,6 @@ func StorageDriverFillRandomStatsFunc(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func StorageDriverTestSampleCpuUsage(driver storage.StorageDriver, t *testing.T) {
|
||||
defer driver.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user