storage unit tests

This commit is contained in:
Nan Deng 2014-06-17 15:12:35 -07:00
parent 7dd1f031a6
commit ca65e11486
2 changed files with 5 additions and 4 deletions

View File

@ -33,5 +33,8 @@ type StorageDriver interface {
// should return at most numSamples samples. // should return at most numSamples samples.
Samples(containername string, numSamples int) ([]*info.ContainerStatsSample, error) Samples(containername string, numSamples int) ([]*info.ContainerStatsSample, error)
// Close will clear the state of the storage driver. The elements
// stored in the underlying storage may or may not be deleted depending
// on the implementation of the storage driver.
Close() error Close() error
} }

View File

@ -59,10 +59,8 @@ func StorageDriverTestSampleCpuUsage(driver storage.StorageDriver, t *testing.T)
// We need N+1 observations to get N samples // We need N+1 observations to get N samples
for i := 0; i < N+1; i++ { for i := 0; i < N+1; i++ {
cpuusage := uint64(rand.Intn(1000)) cpuTrace = append(cpuTrace, uint64(rand.Intn(1000)))
memusage := uint64(rand.Intn(1000)) memTrace = append(memTrace, uint64(rand.Intn(1000)))
cpuTrace = append(cpuTrace, cpuusage)
memTrace = append(memTrace, memusage)
} }
samplePeriod := 1 * time.Second samplePeriod := 1 * time.Second