MCPcopy
hub / github.com/seaweedfs/seaweedfs / waitForFileSize

Function waitForFileSize

test/fuse_integration/writeback_cache_test.go:58–69  ·  view source on GitHub ↗

waitForFileSize polls until a file reports the expected size or timeout expires.

(t *testing.T, path string, expectedSize int64, timeout time.Duration)

Source from the content-addressed store, hash-verified

56
57// waitForFileSize polls until a file reports the expected size or timeout expires.
58func 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
72func TestWritebackCacheBasicOperations(t *testing.T) {

Callers 1

Calls 4

NowMethod · 0.80
AddMethod · 0.45
StatMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected