feat(updater): support updates after verified SeaweedFS migration

This commit is contained in:
2026-09-28 15:47:06 +02:00
parent 790f20b499
commit 2b947c5e8f
20 changed files with 1074 additions and 67 deletions

View File

@@ -0,0 +1,29 @@
import assert from "node:assert/strict";
import test from "node:test";
import { HeadBucketCommand } from "@aws-sdk/client-s3";
import { checkFileStorage } from "../src/modules/system-status.service";
test("file storage health uses an authenticated S3 bucket request for every provider", async () => {
const client = { send: async (command: any, options: any) => {
assert.ok(command instanceof HeadBucketCommand);
assert.deepEqual(command.input, { Bucket: "fedeo" });
assert.ok(options.abortSignal instanceof AbortSignal);
} };
assert.equal((await checkFileStorage(client, "fedeo")).ok, true);
});
test("unconfigured or denied S3 access is unhealthy and does not disclose SDK details", async () => {
assert.equal((await checkFileStorage(null, "fedeo")).ok, false);
const result = await checkFileStorage({ send: async () => { throw new Error("secret@private-host"); } }, "fedeo");
assert.equal(result.ok, false);
assert.ok(!JSON.stringify(result).includes("private-host"));
});
test("S3 health aborts a hung request at its deadline", async () => {
const client = { send: (_command: any, options: any) => new Promise((_resolve, reject) => {
options.abortSignal.addEventListener("abort", () => reject(new Error("aborted")), { once: true });
}) };
const result = await checkFileStorage(client, "fedeo", 10);
assert.equal(result.ok, false);
assert.match(result.error, /Zeitlimit/);
});