From bcab15094644729f311218a4f9da3a1fe50ca199 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sat, 20 Dec 2025 21:20:49 -0600 Subject: [PATCH] refactor(tests): streamline marker file extraction in volume backup tests and enhance path handling --- .../volume-backups/volume-backup.real.test.ts | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts b/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts index a6a1d49ba..f1de5eecf 100644 --- a/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts +++ b/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts @@ -279,16 +279,25 @@ describe( // Extract and verify one file to ensure data integrity // First check if marker file exists in tar - if (tarContents.includes("metadata/marker.txt")) { + if (tarContents.includes("marker.txt")) { const tempDir = path.join(volumeBackupPath, "temp-extract"); await execAsync(`mkdir -p "${tempDir}"`); - await execAsync( - `tar -xf "${backupFilePath}" -C "${tempDir}" metadata/marker.txt`, + + // Extract entire tar to handle path variations (. vs ./ prefix) + await execAsync(`tar -xf "${backupFilePath}" -C "${tempDir}"`); + + // Find marker file regardless of path + const { stdout: markerPath } = await execAsync( + `find "${tempDir}" -name "marker.txt" -type f`, ); - const { stdout: markerContent } = await execAsync( - `cat "${tempDir}/metadata/marker.txt"`, - ); - expect(markerContent.trim()).toBe("marker-67890"); + + if (markerPath.trim()) { + const { stdout: markerContent } = await execAsync( + `cat "${markerPath.trim()}"`, + ); + expect(markerContent.trim()).toBe("marker-67890"); + } + await execAsync(`rm -rf "${tempDir}"`); console.log("✅ Data integrity verified"); } else {