waitForFileSize polls until a file reports the expected size or timeout expires.
(t *testing.T, path string, expectedSize int64, timeout time.Duration)
| 56 | |
| 57 | // waitForFileSize polls until a file reports the expected size or timeout expires. |
| 58 | func waitForFileSize(t *testing.T, path string, expectedSize int64, timeout time.Duration) { |
| 59 | t.Helper() |
| 60 | deadline := time.Now().Add(timeout) |
| 61 | for time.Now().Before(deadline) { |
| 62 | info, err := os.Stat(path) |
| 63 | if err == nil && info.Size() == expectedSize { |
| 64 | return |
| 65 | } |
| 66 | time.Sleep(200 * time.Millisecond) |
| 67 | } |
| 68 | t.Fatalf("file %s did not reach expected size %d within %v", path, expectedSize, timeout) |
| 69 | } |
| 70 | |
| 71 | // TestWritebackCacheBasicOperations tests fundamental file I/O with writebackCache enabled |
| 72 | func TestWritebackCacheBasicOperations(t *testing.T) { |
no test coverage detected