chore: pr feedbacks
This commit is contained in:
parent
c2c0779f8f
commit
cd7edee3bd
3 changed files with 11 additions and 11 deletions
|
|
@ -7,7 +7,7 @@ import { generateBackupOutput } from "~/test/helpers/restic";
|
|||
import { faker } from "@faker-js/faker";
|
||||
import * as spawnModule from "~/server/utils/spawn";
|
||||
|
||||
const resticBackupMock = mock(() => Promise.resolve({ exitCode: 0, stdout: "", stderr: "" }));
|
||||
const resticBackupMock = mock(() => Promise.resolve({ exitCode: 0, summary: "", error: "" }));
|
||||
|
||||
beforeEach(() => {
|
||||
resticBackupMock.mockClear();
|
||||
|
|
@ -31,7 +31,7 @@ describe("execute backup", () => {
|
|||
expect(schedule.nextBackupAt).toBeNull();
|
||||
|
||||
resticBackupMock.mockImplementationOnce(() =>
|
||||
Promise.resolve({ exitCode: 0, stdout: generateBackupOutput(), stderr: "" }),
|
||||
Promise.resolve({ exitCode: 0, summary: generateBackupOutput(), error: "" }),
|
||||
);
|
||||
|
||||
// act
|
||||
|
|
@ -76,7 +76,7 @@ describe("execute backup", () => {
|
|||
});
|
||||
|
||||
resticBackupMock.mockImplementationOnce(() =>
|
||||
Promise.resolve({ exitCode: 0, stdout: generateBackupOutput(), stderr: "" }),
|
||||
Promise.resolve({ exitCode: 0, summary: generateBackupOutput(), error: "" }),
|
||||
);
|
||||
|
||||
// act
|
||||
|
|
@ -97,7 +97,7 @@ describe("execute backup", () => {
|
|||
|
||||
resticBackupMock.mockImplementation(async () => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
return Promise.resolve({ exitCode: 0, stdout: generateBackupOutput(), stderr: "" });
|
||||
return Promise.resolve({ exitCode: 0, summary: generateBackupOutput(), error: "" });
|
||||
});
|
||||
|
||||
// act
|
||||
|
|
@ -119,7 +119,7 @@ describe("execute backup", () => {
|
|||
});
|
||||
|
||||
resticBackupMock.mockImplementationOnce(() =>
|
||||
Promise.resolve({ exitCode: 3, stdout: generateBackupOutput(), stderr: "Some error occurred" }),
|
||||
Promise.resolve({ exitCode: 3, summary: generateBackupOutput(), error: "Some error occurred" }),
|
||||
);
|
||||
|
||||
// act
|
||||
|
|
@ -140,7 +140,7 @@ describe("execute backup", () => {
|
|||
});
|
||||
|
||||
resticBackupMock.mockImplementationOnce(() =>
|
||||
Promise.resolve({ exitCode: 1, stdout: generateBackupOutput(), stderr: "Some error occurred" }),
|
||||
Promise.resolve({ exitCode: 1, summary: generateBackupOutput(), error: "Some error occurred" }),
|
||||
);
|
||||
|
||||
// act
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { config as appConfig } from "../core/config";
|
|||
import { logger } from "./logger";
|
||||
import { cryptoUtils } from "./crypto";
|
||||
import type { RetentionPolicy } from "../modules/backups/backups.dto";
|
||||
import { safeSpawn } from "./spawn";
|
||||
import { safeSpawn, exec } from "./spawn";
|
||||
import type { CompressionMode, RepositoryConfig, OverwriteMode, BandwidthLimit } from "~/schemas/restic";
|
||||
import { ResticError } from "./errors";
|
||||
|
||||
|
|
@ -355,8 +355,8 @@ const backup = async (
|
|||
},
|
||||
});
|
||||
|
||||
includeFile && (await fs.unlink(includeFile).catch(() => {}));
|
||||
excludeFile && (await fs.unlink(excludeFile).catch(() => {}));
|
||||
if (includeFile) await fs.unlink(includeFile).catch(() => {});
|
||||
if (excludeFile) await fs.unlink(excludeFile).catch(() => {});
|
||||
await cleanupTemporaryKeys(env);
|
||||
|
||||
if (options?.signal?.aborted) {
|
||||
|
|
@ -385,7 +385,7 @@ const backup = async (
|
|||
summaryLine = "{}";
|
||||
}
|
||||
|
||||
logger.debug(`Restic restore output last line: ${summaryLine}`);
|
||||
logger.debug(`Restic backup output last line: ${summaryLine}`);
|
||||
const result = backupOutputSchema(summaryLine);
|
||||
|
||||
if (result instanceof type.errors) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export default defineConfig({
|
|||
},
|
||||
},
|
||||
server: {
|
||||
host: true,
|
||||
host: '0.0.0.0',
|
||||
port: 4096,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue