Skip to content

Commit 2413064

Browse files
committed
delete irrelevant test
1 parent 89ac144 commit 2413064

File tree

1 file changed

+0
-199
lines changed

1 file changed

+0
-199
lines changed

internal-packages/run-engine/src/engine/tests/batchTriggerAndWait.test.ts

Lines changed: 0 additions & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -588,203 +588,4 @@ describe("RunEngine batchTriggerAndWait", () => {
588588
}
589589
}
590590
);
591-
592-
containerTest(
593-
"batch ID should not carry over to blockRunWithWaitpoint",
594-
async ({ prisma, redisOptions }) => {
595-
//create environment
596-
const authenticatedEnvironment = await setupAuthenticatedEnvironment(prisma, "PRODUCTION");
597-
598-
const engine = new RunEngine({
599-
prisma,
600-
worker: {
601-
redis: redisOptions,
602-
workers: 1,
603-
tasksPerWorker: 10,
604-
pollIntervalMs: 20,
605-
},
606-
queue: {
607-
redis: redisOptions,
608-
},
609-
runLock: {
610-
redis: redisOptions,
611-
},
612-
machines: {
613-
defaultMachine: "small-1x",
614-
machines: {
615-
"small-1x": {
616-
name: "small-1x" as const,
617-
cpu: 0.5,
618-
memory: 0.5,
619-
centsPerMs: 0.0001,
620-
},
621-
},
622-
baseCostInCents: 0.0001,
623-
},
624-
tracer: trace.getTracer("test", "0.0.0"),
625-
});
626-
627-
try {
628-
const parentTask = "parent-task";
629-
const childTask = "child-task";
630-
631-
//create background worker
632-
await setupBackgroundWorker(engine, authenticatedEnvironment, [parentTask, childTask]);
633-
634-
//create a batch
635-
const batch = await prisma.batchTaskRun.create({
636-
data: {
637-
friendlyId: generateFriendlyId("batch"),
638-
runtimeEnvironmentId: authenticatedEnvironment.id,
639-
},
640-
});
641-
642-
//trigger the parent run
643-
const parentRun = await engine.trigger(
644-
{
645-
number: 1,
646-
friendlyId: "run_p1234",
647-
environment: authenticatedEnvironment,
648-
taskIdentifier: parentTask,
649-
payload: "{}",
650-
payloadType: "application/json",
651-
context: {},
652-
traceContext: {},
653-
traceId: "t12345",
654-
spanId: "s12345",
655-
masterQueue: "main",
656-
queue: `task/${parentTask}`,
657-
isTest: false,
658-
tags: [],
659-
},
660-
prisma
661-
);
662-
663-
//dequeue parent
664-
const dequeued = await engine.dequeueFromMasterQueue({
665-
consumerId: "test_12345",
666-
masterQueue: parentRun.masterQueue,
667-
maxRunCount: 10,
668-
});
669-
670-
//create an attempt
671-
const initialExecutionData = await engine.getRunExecutionData({ runId: parentRun.id });
672-
assertNonNullable(initialExecutionData);
673-
const attemptResult = await engine.startRunAttempt({
674-
runId: parentRun.id,
675-
snapshotId: initialExecutionData.snapshot.id,
676-
});
677-
678-
//block using the batch
679-
await engine.blockRunWithCreatedBatch({
680-
runId: parentRun.id,
681-
batchId: batch.id,
682-
environmentId: authenticatedEnvironment.id,
683-
projectId: authenticatedEnvironment.projectId,
684-
organizationId: authenticatedEnvironment.organizationId,
685-
});
686-
687-
// Create a batch child
688-
const batchChild = await engine.trigger(
689-
{
690-
number: 1,
691-
friendlyId: "run_c1234",
692-
environment: authenticatedEnvironment,
693-
taskIdentifier: childTask,
694-
payload: "{}",
695-
payloadType: "application/json",
696-
context: {},
697-
traceContext: {},
698-
traceId: "t12345",
699-
spanId: "s12345",
700-
masterQueue: "main",
701-
queue: `task/${childTask}`,
702-
isTest: false,
703-
tags: [],
704-
resumeParentOnCompletion: true,
705-
parentTaskRunId: parentRun.id,
706-
batch: { id: batch.id, index: 0 },
707-
},
708-
prisma
709-
);
710-
711-
// Complete the batch child
712-
const dequeuedChild = await engine.dequeueFromMasterQueue({
713-
consumerId: "test_12345",
714-
masterQueue: batchChild.masterQueue,
715-
maxRunCount: 1,
716-
});
717-
718-
const childAttempt = await engine.startRunAttempt({
719-
runId: batchChild.id,
720-
snapshotId: dequeuedChild[0].snapshot.id,
721-
});
722-
723-
await engine.completeRunAttempt({
724-
runId: batchChild.id,
725-
snapshotId: childAttempt.snapshot.id,
726-
completion: {
727-
id: batchChild.id,
728-
ok: true,
729-
output: '{"foo":"bar"}',
730-
outputType: "application/json",
731-
},
732-
});
733-
734-
// Unblock the batch
735-
await engine.unblockRunForCreatedBatch({
736-
runId: parentRun.id,
737-
batchId: batch.id,
738-
environmentId: authenticatedEnvironment.id,
739-
projectId: authenticatedEnvironment.projectId,
740-
});
741-
742-
// Create a regular child to get its waitpoint
743-
const regularChild = await engine.trigger(
744-
{
745-
number: 2,
746-
friendlyId: "run_c12345",
747-
environment: authenticatedEnvironment,
748-
taskIdentifier: childTask,
749-
payload: "{}",
750-
payloadType: "application/json",
751-
context: {},
752-
traceContext: {},
753-
traceId: "t123456",
754-
spanId: "s123456",
755-
masterQueue: "main",
756-
queue: `task/${childTask}`,
757-
isTest: false,
758-
tags: [],
759-
},
760-
prisma
761-
);
762-
763-
// Get the child's waitpoint
764-
const childRunWithWaitpoint = await prisma.taskRun.findUniqueOrThrow({
765-
where: { id: regularChild.id },
766-
include: {
767-
associatedWaitpoint: true,
768-
},
769-
});
770-
771-
// Block the parent with the child's waitpoint
772-
const blockedResult = await engine.blockRunWithWaitpoint({
773-
runId: parentRun.id,
774-
waitpoints: childRunWithWaitpoint.associatedWaitpoint!.id,
775-
projectId: authenticatedEnvironment.project.id,
776-
organizationId: authenticatedEnvironment.organizationId,
777-
tx: prisma,
778-
});
779-
780-
// Check that the parent's execution data doesn't have a batch ID
781-
const parentExecutionData = await engine.getRunExecutionData({ runId: parentRun.id });
782-
assertNonNullable(parentExecutionData);
783-
expect(parentExecutionData.snapshot.executionStatus).toBe("EXECUTING_WITH_WAITPOINTS");
784-
expect(parentExecutionData.batch).toBeUndefined();
785-
} finally {
786-
engine.quit();
787-
}
788-
}
789-
);
790591
});

0 commit comments

Comments
 (0)