This test verifies the usage of a file.
| 82 | |
| 83 | // This test verifies the usage of a file. |
| 84 | TEST_F(DiskUsageCollectorTest, File) |
| 85 | { |
| 86 | // Create a file and write 8K bytes. |
| 87 | string path = path::join(os::getcwd(), "file"); |
| 88 | ASSERT_SOME(os::write(path, string(Kilobytes(8).bytes(), 'x'))); |
| 89 | |
| 90 | DiskUsageCollector collector(Milliseconds(1)); |
| 91 | |
| 92 | Future<Bytes> usage = collector.usage(path, {}); |
| 93 | AWAIT_READY(usage); |
| 94 | |
| 95 | // NOTE: A typical file system needs more disk space to keep meta |
| 96 | // data. So the check here is not a strict equal-to check. |
| 97 | EXPECT_GE(usage.get(), Kilobytes(8)); |
| 98 | } |
| 99 | |
| 100 | |
| 101 | // This test verifies the usage of a directory. |
nothing calls this directly
no test coverage detected