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

@@ -300,13 +300,17 @@ func TestMetrics(t *testing.T) {
t.Errorf("Failed to make a new Builder: %v", err)
}
// TODO(pwittroc): Move this into a reusable testing utility
expectedEmptyDirUsage, err := volume.FindEmptyDirectoryUsageOnTmpfs()
if err != nil {
t.Errorf("Unexpected error finding expected empty directory usage on tmpfs: %v", err)
}
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)
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")