test(cli): cover adaptive journal S3 end to end

This commit is contained in:
vorotamoroz
2026-07-31 19:24:19 +00:00
parent 73e34aef7c
commit f3b0fbb29b
7 changed files with 168 additions and 1 deletions
+37
View File
@@ -466,6 +466,43 @@ export async function stopMinio(): Promise<void> {
untrackContainer(MINIO_CONTAINER);
}
export async function listMinioObjectKeys(
minioEndpoint: string,
accessKey: string,
secretKey: string,
bucket: string
): Promise<string[]> {
const cmd =
`mc alias set myminio ${shQuote(minioEndpoint)} ${shQuote(accessKey)} ${shQuote(secretKey)} >/dev/null 2>&1 && ` +
`mc ls --recursive --json myminio/${shQuote(bucket)}`;
const result = await docker(
"run",
"--rm",
"--network",
"host",
"--entrypoint",
"/bin/sh",
MINIO_MC_IMAGE,
"-c",
cmd
);
if (result.code !== 0) {
throw new Error(`Could not list MinIO objects: ${result.stderr.trim()}`);
}
return result.stdout
.split(/\r?\n/u)
.filter((line) => line.trim().length > 0)
.map((line) => JSON.parse(line) as { key?: unknown })
.map(({ key }) => {
if (typeof key !== "string") {
throw new Error("MinIO returned an object without a string key");
}
return key;
})
.sort();
}
async function initMinioBucket(
minioEndpoint: string,
accessKey: string,