feat(FN-5407): add paired central backup support to backup command and stor
FN-5407 adds paired central backup support to the Fusion task management system, with both the core backup engine and CLI commands updated to handle central database backup pairs. Documentation was updated to reflect the new capability, and two stabilization fixes were included to handle central bac Fusion-Task-Id: FN-5407
This commit is contained in:
committed by
gsxdsm
parent
1a5aff9c44
commit
2baaad743a
@@ -17,6 +17,7 @@ const piModuleMocks = vi.hoisted(() => ({
|
||||
|
||||
const coreModuleMocks = vi.hoisted(() => ({
|
||||
runMemoryBackupCommand: vi.fn(),
|
||||
runBackupCommand: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("../logger.js", () => ({
|
||||
@@ -37,6 +38,7 @@ vi.mock("@fusion/core", async (importOriginal) => {
|
||||
return {
|
||||
...actual,
|
||||
runMemoryBackupCommand: coreModuleMocks.runMemoryBackupCommand,
|
||||
runBackupCommand: coreModuleMocks.runBackupCommand,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -120,6 +122,10 @@ describe("CronRunner", () => {
|
||||
success: true,
|
||||
output: "memory backup ok",
|
||||
});
|
||||
coreModuleMocks.runBackupCommand.mockResolvedValue({
|
||||
success: true,
|
||||
output: "Backup created: fusion-2026-01-01-000000.db + fusion-central-2026-01-01-000000.db (1 MB).",
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -1888,6 +1894,22 @@ describe("CronRunner", () => {
|
||||
}
|
||||
});
|
||||
|
||||
describe("backup in-process dispatch", () => {
|
||||
it("routes fn backup --create through runBackupCommand", async () => {
|
||||
const store = createMockStore() as unknown as TaskStore & { getFusionDir: () => string };
|
||||
store.getFusionDir = vi.fn().mockReturnValue("/tmp/.fusion");
|
||||
const schedule = createMockSchedule({ id: "db-bk", command: "fn backup --create" });
|
||||
runner = new CronRunner(store, createMockAutomationStore());
|
||||
|
||||
const runResult = await (runner as unknown as { executeLegacyCommand: (s: ScheduledTask, startedAt: string) => Promise<AutomationRunResult> })
|
||||
.executeLegacyCommand(schedule, new Date().toISOString());
|
||||
|
||||
expect(coreModuleMocks.runBackupCommand).toHaveBeenCalledWith("/tmp/.fusion", expect.any(Object));
|
||||
expect(runResult.success).toBe(true);
|
||||
expect(runResult.output).toContain("fusion-central-");
|
||||
});
|
||||
});
|
||||
|
||||
describe("memory backup in-process dispatch", () => {
|
||||
it("routes fn memory-backup --create through runMemoryBackupCommand", async () => {
|
||||
const store = createMockStore() as unknown as TaskStore & { getFusionDir: () => string };
|
||||
|
||||
Reference in New Issue
Block a user