mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
refactor(tests): restore cleanup logic in volume restore tests
This commit is contained in:
@@ -85,37 +85,37 @@ describe(
|
||||
);
|
||||
});
|
||||
|
||||
// afterEach(async () => {
|
||||
// console.log(`\n🧹 Cleanup: ${currentVolumeName}`);
|
||||
// await cleanupDocker(currentVolumeName);
|
||||
// await cleanupFiles(currentAppName);
|
||||
afterEach(async () => {
|
||||
console.log(`\n🧹 Cleanup: ${currentVolumeName}`);
|
||||
await cleanupDocker(currentVolumeName);
|
||||
await cleanupFiles(currentAppName);
|
||||
|
||||
// // Clean all test volumes
|
||||
// try {
|
||||
// const { stdout } = await execAsync(
|
||||
// `docker volume ls -q --filter "name=test-vol-" || true`,
|
||||
// );
|
||||
// if (stdout.trim()) {
|
||||
// for (const vol of stdout.trim().split("\n")) {
|
||||
// await execAsync(`docker volume rm ${vol} 2>/dev/null || true`);
|
||||
// }
|
||||
// }
|
||||
// } catch {
|
||||
// // Ignore
|
||||
// }
|
||||
// Clean all test volumes
|
||||
try {
|
||||
const { stdout } = await execAsync(
|
||||
`docker volume ls -q --filter "name=test-vol-" || true`,
|
||||
);
|
||||
if (stdout.trim()) {
|
||||
for (const vol of stdout.trim().split("\n")) {
|
||||
await execAsync(`docker volume rm ${vol} 2>/dev/null || true`);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
// // Clean all test backup directories
|
||||
// try {
|
||||
// const { VOLUME_BACKUPS_PATH } = paths(false);
|
||||
// await execAsync(
|
||||
// `find "${VOLUME_BACKUPS_PATH}" -maxdepth 1 -type d -name "test-*" -exec rm -rf {} + 2>/dev/null || true`,
|
||||
// );
|
||||
// } catch {
|
||||
// // Ignore
|
||||
// }
|
||||
// Clean all test backup directories
|
||||
try {
|
||||
const { VOLUME_BACKUPS_PATH } = paths(false);
|
||||
await execAsync(
|
||||
`find "${VOLUME_BACKUPS_PATH}" -maxdepth 1 -type d -name "test-*" -exec rm -rf {} + 2>/dev/null || true`,
|
||||
);
|
||||
} catch {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
// console.log("✅ Cleanup done\n");
|
||||
// });
|
||||
console.log("✅ Cleanup done\n");
|
||||
});
|
||||
|
||||
it(
|
||||
"should restore volume using real restoreVolume ",
|
||||
|
||||
Reference in New Issue
Block a user