From 4ce60941db9b6f1bc51e847d7d19eee5db18298f Mon Sep 17 00:00:00 2001 From: yuanhaoz Date: Mon, 9 Dec 2024 16:59:28 -0800 Subject: [PATCH] add unit test --- .../test/glue/start-job-run.test.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts index 8c8088e23de2e..e20f923a48af3 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts @@ -39,6 +39,42 @@ test('Invoke glue job with just job ARN', () => { }); }); +test('Invoke glue job with dynamic worker type', () => { + const task = new GlueStartJobRun(stack, 'Task', { + glueJobName, + workerConfiguration: { + workerType: WorkerType.of(sfn.JsonPath.stringAt('$.workerType')), + numberOfWorkers: 2, + }, + }); + + new sfn.StateMachine(stack, 'SM', { + definitionBody: sfn.DefinitionBody.fromChainable(task), + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::glue:startJobRun', + ], + ], + }, + End: true, + Parameters: { + 'JobName': glueJobName, + 'NumberOfWorkers': 2, + 'WorkerType.$': '$.workerType', + }, + }); +}); + test('Invoke glue job with full properties', () => { const jobArguments = { key: 'value',