Skip to content

Commit

Permalink
feat(AWS Local Invocation): Support ruby3.2 (#12004)
Browse files Browse the repository at this point in the history
  • Loading branch information
theRocket committed Jun 5, 2023
1 parent b82efaf commit 0a0a4fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/plugins/aws/invoke-local/index.js
Expand Up @@ -283,7 +283,7 @@ class AwsInvokeLocal {
);
}

if (['ruby2.7'].includes(runtime)) {
if (['ruby2.7', 'ruby3.2'].includes(runtime)) {
const handlerComponents = handler.split(/\./);
const handlerPath = handlerComponents[0];
const handlerName = handlerComponents.slice(1).join('.');
Expand Down
1 change: 1 addition & 0 deletions lib/plugins/aws/provider.js
Expand Up @@ -630,6 +630,7 @@ class AwsProvider {
'python3.9',
'python3.10',
'ruby2.7',
'ruby3.2',
],
},
awsLambdaRuntimeManagement: {
Expand Down
11 changes: 11 additions & 0 deletions test/unit/lib/plugins/aws/invoke-local/index.test.js
Expand Up @@ -478,6 +478,17 @@ describe('AwsInvokeLocal', () => {
).to.be.equal(true);
});

it('should call invokeLocalRuby when ruby3.2 runtime is set', async () => {
awsInvokeLocal.options.functionObj.runtime = 'ruby3.2';
await awsInvokeLocal.invokeLocal();
// NOTE: this is important so that tests on Windows won't fail
const runtime = process.platform === 'win32' ? 'ruby.exe' : 'ruby';
expect(invokeLocalRubyStub.calledOnce).to.be.equal(true);
expect(
invokeLocalRubyStub.calledWithExactly(runtime, 'handler', 'hello', {}, undefined)
).to.be.equal(true);
});

it('should call invokeLocalDocker if using runtime provided', async () => {
awsInvokeLocal.options.functionObj.runtime = 'provided';
awsInvokeLocal.options.functionObj.handler = 'handler.foobar';
Expand Down

0 comments on commit 0a0a4fc

Please sign in to comment.