Change:
volumetest "k8s.io/kubernetes/pkg/volume/testing" ) <del> const expectedBlockSize = 4096 </del> <ins> func getExpectedBlockSize(path string) int64 { statfs := &syscall.Statfs_t{} err := syscall.Statfs(path, statfs) if err != nil { return 0 } return int64(statfs.Bsize) } </ins> // TestMetricsDuGetCapacity tests that MetricsDu can read disk usage // for path

Discussion:
<!-- Thanks for filing an issue! Before hitting the button, please answer these questions.--Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see ): What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): TestMetricsDuGetCapacity Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT <!-- If this is a BUG REPORT, please: Fill in as much of the template below as you can. If you leave out information, we can't help you as well. If this is a FEATURE REQUEST, please: Describe in detail the feature/behavior/change you'd like to see. In both cases, be ready for followup questions, and please respond in a timely manner. If we can't reproduce a bug or think a feature already exists, we might close your issue. If we're wrong, PLEASE feel free to reopen it and explain why. --Kubernetes version (use ): master branch (tip) Environment: Cloud provider or hardware configuration: OS (e.g. from /etc/os-release): SLES 12 Kernel (e.g. ): Linux pts00449-vm23 3.12.28-4-default SMP Thu Sep 25 17:02:34 UTC 2014 () ppc64le ppc64le ppc64le GNU/Linux Install tools: Others: What happened: make test WHAT="./pkg/volume" Running tests for APIVersion: v1,apps/v1beta1,,,,,autoscaling/v1,autoscaling/v2alpha1,batch/v1,batch/v2alpha1,,extensions/v1beta1,,policy/v1beta1,,,,,,federation/v1beta1 +++ [0404 11:22:46] Running tests without code coverage --- FAIL: TestMetricsDuGetCapacity (0.01s) Unexpected Used for directory with file. Expected 4096, got .

FAIL FAIL 0.137s Makefile:164: recipe for target 'test' failed make: [test] Error 1 Test case failed What you expected to happen: Test case should pass How to reproduce it (as minimally and precisely as possible): make test WHAT="./pkg/volume" Anything else we need to know*: Found this similar issue: However the values returned are different, see this string "Expected 4096, got "
Hi, I am able to run that tests: I am running RHEL ppc64le, latest k8s with go1.8, probably something specific to do with SLES?
I still get the error on SLES, updated the code to latest and using go1.8, maybe it is SLES (or my machine?) specific talks about /tmp space, not sure if its related..
Hi , Some investigation into this i found that the issue is due to the hardcoding on line 32 in (similar from comments here: ) I changed it to remove the hardcoding (patch attached) and the test case passes on SLES as well, i am not sure if the patch is appropriate so requesting you to review it as appropriate
Hi Vaibhav, Have you raised any PR on it? If raised, reviewing would be easier. There is one thing I noticed: In the above code, you are comparing actual used value with total of empty directory usage and expected block size. When you create a new file like "f1 created here with only "Hello World", it consumes 4K in Ubuntu/RHEL. This size is same as for an empty directory. What is this size in SLES? So, either you hardcode this value(conditional for SLES) or call getExpectedBlockSize() on f1 file path instead of tmpDir.
Hi I have created the PR for the patch as suggested.. I have also changed the original patch slightly to use getExpectedBlockSize() on f1 file path instead of tmpDir as you suggested as that I think would be the right way to do it.. Thanks! Vaibhav
/sig storage