This is an automated email from the ASF dual-hosted git repository. bbannier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit d16279206f34d7a260499dca4817e3ff8fba777a Author: Benjamin Mahler <[email protected]> AuthorDate: Wed Nov 7 22:36:17 2018 +0100 Fixed flakiness in `FsTest.Used`. Unfortunately, we cannot easily verify that the value coming from `fs::used()` is correct, as the filesystem may be modified at any point in time. Review: https://reviews.apache.org/r/69276/ --- 3rdparty/stout/tests/os/filesystem_tests.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/3rdparty/stout/tests/os/filesystem_tests.cpp b/3rdparty/stout/tests/os/filesystem_tests.cpp index 29f06f3..071864b 100644 --- a/3rdparty/stout/tests/os/filesystem_tests.cpp +++ b/3rdparty/stout/tests/os/filesystem_tests.cpp @@ -810,10 +810,13 @@ TEST_F(FsTest, Used) Try<Bytes> used = fs::used("."); ASSERT_SOME(used); - struct statvfs b; - ASSERT_EQ(0, ::statvfs(".", &b)); + Try<Bytes> size = fs::size("."); + ASSERT_SOME(size); - // Check that the block counts match. - EXPECT_EQ(used.get() / b.f_frsize, b.f_blocks - b.f_bfree); + // We unfortunately can't easily verify the used value since + // the disk usage can change at any point. + + EXPECT_GT(used.get(), 0u); + EXPECT_LT(used.get(), size.get()); } #endif // __WINDOWS__
