From 647b46bd8a6c6b574daf4d91927779476c510f4f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 2 Apr 2026 11:49:13 -0700 Subject: [PATCH] Fix flaky FUSE integration tests - concurrent_operations_test: Add retry loop for transient I/O errors on file close during ConcurrentDirectoryOperations - git_operations_test: Wait for pushed objects to become visible through FUSE mount before cloning in Phase 3 --- test/fuse_integration/concurrent_operations_test.go | 13 ++++++++++--- test/fuse_integration/git_operations_test.go | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/test/fuse_integration/concurrent_operations_test.go b/test/fuse_integration/concurrent_operations_test.go index b40d3fdc5..de0d50f18 100644 --- a/test/fuse_integration/concurrent_operations_test.go +++ b/test/fuse_integration/concurrent_operations_test.go @@ -249,11 +249,18 @@ func testConcurrentDirectoryOperations(t *testing.T, framework *FuseTestFramewor return } - // Create file in subdirectory + // Create file in subdirectory with retry for transient FUSE errors testFile := filepath.Join(subDir, "test.txt") content := []byte(fmt.Sprintf("Worker %d, Subdir %d", workerID, i)) - if err := os.WriteFile(testFile, content, 0644); err != nil { - addError(fmt.Errorf("worker %d file %d: %v", workerID, i, err)) + var writeErr error + for attempt := 0; attempt < 3; attempt++ { + if writeErr = os.WriteFile(testFile, content, 0644); writeErr == nil { + break + } + time.Sleep(100 * time.Millisecond) + } + if writeErr != nil { + addError(fmt.Errorf("worker %d file %d: %v", workerID, i, writeErr)) return } } diff --git a/test/fuse_integration/git_operations_test.go b/test/fuse_integration/git_operations_test.go index 50328d000..2ea914d60 100644 --- a/test/fuse_integration/git_operations_test.go +++ b/test/fuse_integration/git_operations_test.go @@ -85,6 +85,13 @@ func testGitCloneAndPull(t *testing.T, mountPoint, localDir string) { branch := gitOutput(t, localClone, "rev-parse", "--abbrev-ref", "HEAD") gitRun(t, localClone, "push", "origin", branch) + // Wait for pushed objects to become visible through the FUSE mount. + // After git push, pack objects may not be immediately consistent on + // the FUSE layer, causing clone to fail with "nonexistent object". + waitForBareRepoEventually(t, bareRepo, 10*time.Second) + refreshDirEntry(t, bareRepo) + time.Sleep(1 * time.Second) + // ---- Phase 3: Clone from mount bare repo into on-mount working dir ---- t.Log("Phase 3: clone from mount bare repo to on-mount working dir") gitRun(t, "", "clone", bareRepo, mountClone)