Skip to content

Commit ea0ba19

Browse files
committed
test(aws-lambda): the audio task's free worker holds for a reserved pool of 1 and 2
1 parent 5eae3f0 commit ea0ba19

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

‎packages/aws-lambda/src/handler.test.ts‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,11 @@ describe("handler dispatch", () => {
10121012
expect(url.searchParams.get("X-Amz-Signature")).toMatch(/^[a-f0-9]{64}$/);
10131013
});
10141014

1015-
async function planStitched(chunkCount: number, separateAudio = false, workerConcurrency = 16) {
1015+
async function planStitched(
1016+
chunkCount: number,
1017+
separateAudio = false,
1018+
workerConcurrency?: number,
1019+
) {
10161020
const tmpRoot = makeTmpRoot();
10171021
const s3 = new FakeS3Client();
10181022
s3.objects.set("s3://bucket/project.tar.gz", await makeMinimalProjectTar());
@@ -1081,6 +1085,22 @@ describe("handler dispatch", () => {
10811085
const one = await planStitched(8, false, 1);
10821086
expect(planOptions(one)).toMatchObject({ deferAudio: false });
10831087
expect([one.planned.SeparateAudio, one.planned.MaxChunkConcurrency]).toEqual([false, 1]);
1088+
for (const [reserved, separate, chunks] of [
1089+
["2", true, 1],
1090+
["1", false, 1],
1091+
] as const) {
1092+
process.env.HYPERFRAMES_LAMBDA_RESERVED_CONCURRENCY = reserved;
1093+
try {
1094+
const run = await planStitched(8, separate, undefined);
1095+
expect(planOptions(run)).toMatchObject({ deferAudio: separate });
1096+
expect([run.planned.SeparateAudio, run.planned.MaxChunkConcurrency]).toEqual([
1097+
separate,
1098+
chunks,
1099+
]);
1100+
} finally {
1101+
delete process.env.HYPERFRAMES_LAMBDA_RESERVED_CONCURRENCY;
1102+
}
1103+
}
10841104
});
10851105

10861106
it.skipIf(spawnSync("ffmpeg", ["-version"]).status !== 0)(

0 commit comments

Comments
 (0)