Merge pull request #56643 from dashpole/fix_coreos_disk_test

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

[Test Fix] Make requirements less precise for disk eviction test

**What this PR does / why we need it**:
Makes the local storage eviction test require less precision.  On coreos and other OS distributions which report the actual disk usage, rather than apparent, an empty file can consume disk space.
Since the test creates 299 files (each containing 1Mb of data), the extra 4kb disk space reported by each file causes the test in its current form to fail, because it exceeds the 300Mb limit. (4kb * 299 > 1 Mb).
This change makes the test only create 297 files, which will ensure that small differences in distributions like this do not cause the test to fail.

This behavior was actually meant to be tested in the `LocalStorageCapacityIsolationEviction` test, but was omitted.  I have added a test case to that test as well.

**Which issue(s) this PR fixes**:
Fixes #56234

```release-note
NONE
```
/sig node
/priority critical-urgent
/kind bug

As this is a testing only change, my hope is to include it in the 1.9 release.
/assign @dchen1107 
/assign @rphillips
This commit is contained in:
Kubernetes Submit Queue 2017-12-06 14:49:30 -08:00 committed by GitHub
commit 88db9a750b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,6 +225,10 @@ var _ = framework.KubeDescribe("LocalStorageCapacityIsolationEviction [Slow] [Se
EmptyDir: &v1.EmptyDirVolumeSource{SizeLimit: &sizeLimit},
}, v1.ResourceRequirements{}),
},
{
evictionPriority: 0, // This pod should not be evicted because it uses less than its limit
pod: diskConsumingPod("emptydir-disk-below-sizelimit", useUnderLimit, nil, v1.ResourceRequirements{Limits: containerLimit}),
},
})
})
})
@ -306,7 +310,8 @@ var _ = framework.KubeDescribe("PriorityLocalStorageEvictionOrdering [Slow] [Ser
},
{
evictionPriority: 0,
pod: diskConsumingPod("guaranteed-disk", 299 /* Mb */, nil, v1.ResourceRequirements{
// Only require 99% accuracy (297/300 Mb) because on some OS distributions, the file itself (excluding contents), consumes disk space.
pod: diskConsumingPod("guaranteed-disk", 297 /* Mb */, nil, v1.ResourceRequirements{
Requests: v1.ResourceList{
v1.ResourceEphemeralStorage: resource.MustParse("300Mi"),
},