Skip to content

Commit bd15fc9

Browse files
committed
rename entry points lambda
1 parent 6649aa9 commit bd15fc9

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

lambdas/functions/webhook/jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const config: Config = {
66
...defaultConfig,
77
coverageThreshold: {
88
global: {
9-
statements: 99.2,
9+
statements: 99.58,
1010
branches: 100,
1111
functions: 100,
12-
lines: 99.25,
12+
lines: 99.57,
1313
},
1414
},
1515
};

lambdas/functions/webhook/src/lambda.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { APIGatewayEvent, Context } from 'aws-lambda';
33
import { mocked } from 'jest-mock';
44
import { WorkflowJobEvent } from '@octokit/webhooks-types';
55

6-
import { dispatchToRunners, eventBridgeWebhook, githubWebhook } from './lambda';
6+
import { dispatchToRunners, eventBridgeWebhook, directWebhook } from './lambda';
77
import { handle, publishOnEventBridge } from './webhook';
88
import ValidationError from './ValidationError';
99
import { getParameter } from '@aws-github-runner/aws-ssm-util';
@@ -98,23 +98,23 @@ describe('Test webhook lambda wrapper.', () => {
9898
});
9999
});
100100

101-
const result = await githubWebhook(event, context);
101+
const result = await directWebhook(event, context);
102102
expect(result).toEqual({ body: 'test', statusCode: 200 });
103103
});
104104

105105
it('An expected error, resolve.', async () => {
106106
const mock = mocked(handle);
107107
mock.mockRejectedValue(new ValidationError(400, 'some error'));
108108

109-
const result = await githubWebhook(event, context);
109+
const result = await directWebhook(event, context);
110110
expect(result).toMatchObject({ body: 'some error', statusCode: 400 });
111111
});
112112

113113
it('Errors are not thrown.', async () => {
114114
const mock = mocked(handle);
115115
const logSpy = jest.spyOn(logger, 'error');
116116
mock.mockRejectedValue(new Error('some error'));
117-
const result = await githubWebhook(event, context);
117+
const result = await directWebhook(event, context);
118118
expect(result).toMatchObject({ body: 'Check the Lambda logs for the error details.', statusCode: 500 });
119119
expect(logSpy).toHaveBeenCalledTimes(1);
120120
});

lambdas/functions/webhook/src/lambda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export interface Response {
1515
body: string;
1616
}
1717

18-
middy(githubWebhook).use(captureLambdaHandler(tracer));
18+
middy(directWebhook).use(captureLambdaHandler(tracer));
1919

20-
export async function githubWebhook(event: APIGatewayEvent, context: Context): Promise<Response> {
20+
export async function directWebhook(event: APIGatewayEvent, context: Context): Promise<Response> {
2121
setContext(context, 'lambda.ts');
2222
logger.logEventIfEnabled(event);
2323

modules/webhook/direct/webhook.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resource "aws_lambda_function" "webhook" {
1010
source_code_hash = var.config.lambda_s3_bucket == null ? filebase64sha256(local.lambda_zip) : null
1111
function_name = "${var.config.prefix}-webhook"
1212
role = aws_iam_role.webhook_lambda.arn
13-
handler = "index.githubWebhook"
13+
handler = "index.directWebhook"
1414
runtime = var.config.lambda_runtime
1515
memory_size = var.config.lambda_memory_size
1616
timeout = var.config.lambda_timeout

0 commit comments

Comments
 (0)