Fix assumptions about tmpfs in metrics du tests

This commit is contained in:
Paul Morie
2015-12-11 12:55:17 -05:00
parent 775369a8f1
commit eb89c2519a
4 changed files with 52 additions and 13 deletions

View File

@@ -298,13 +298,18 @@ func TestMetrics(t *testing.T) {
// Need to create the subdirectory
os.MkdirAll(builder.GetPath(), 0755)
expectedEmptyDirUsage, err := volume.FindEmptyDirectoryUsageOnTmpfs()
if err != nil {
t.Errorf("Unexpected error finding expected empty directory usage on tmpfs: %v", err)
}
// TODO(pwittroc): Move this into a reusable testing utility
metrics, err := builder.GetMetrics()
if err != nil {
t.Errorf("Unexpected error when calling GetMetrics %v", err)
}
if metrics.Used.Value() != 4096 {
t.Errorf("Expected Used %d to be 4096", metrics.Used.Value())
if e, a := expectedEmptyDirUsage.Value(), metrics.Used.Value(); e != a {
t.Errorf("Unexpected value for empty directory; expected %v, got %v", e, a)
}
if metrics.Capacity.Value() <= 0 {
t.Errorf("Expected Capacity to be greater than 0")