Skip to content

chore(layers): remove schema parsing from layer canary #3171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions layers/tests/e2e/layerPublisher.class.test.functionCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
import { DynamoDBProvider } from '@aws-lambda-powertools/parameters/dynamodb';
import { SecretsProvider } from '@aws-lambda-powertools/parameters/secrets';
import { SSMProvider } from '@aws-lambda-powertools/parameters/ssm';
import { EventBridgeSchema } from '@aws-lambda-powertools/parser/schemas';
import { Tracer } from '@aws-lambda-powertools/tracer';
import { AppConfigDataClient } from '@aws-sdk/client-appconfigdata';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
import { SSMClient } from '@aws-sdk/client-ssm';
import { z } from 'zod';

const logger = new Logger({
logLevel: 'DEBUG',
Expand Down Expand Up @@ -50,10 +48,6 @@ new DynamoDBProvider({ tableName: 'foo', awsSdkV3Client: ddbClient });
// Instantiating the BatchProcessor will confirm that the utility can be used
new BatchProcessor(EventType.SQS);

const testSchema = z.object({ instance_id: z.string(), state: z.string() });

const testEventSchema = EventBridgeSchema.extend({ detail: testSchema });

const layerPath = process.env.LAYERS_PATH || '/opt/nodejs/node_modules';
const expectedVersion = process.env.POWERTOOLS_PACKAGE_VERSION || '0.0.0';

Expand Down Expand Up @@ -122,7 +116,4 @@ export const handler = async (event: unknown): Promise<void> => {
// the presence of a log will indicate that the logger is working
// while the content of the log will indicate that the tracer is working
logger.debug('subsegment', { subsegment: subsegment.format() });

// Check that the parser is working
testEventSchema.parse(event);
};
19 changes: 0 additions & 19 deletions layers/tests/e2e/layerPublisher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { TestNodejsFunction } from '@aws-lambda-powertools/testing-utils/resources/lambda';
import { App } from 'aws-cdk-lib';
import { LayerVersion } from 'aws-cdk-lib/aws-lambda';
import type { EventBridgeEvent } from 'aws-lambda';
import packageJson from '../../package.json';
import { LayerPublisherStack } from '../../src/layer-publisher-stack';
import {
Expand Down Expand Up @@ -133,24 +132,6 @@ describe('Layers E2E tests', () => {
functionName: testStack.findAndGetStackOutputValue(
`test${outputFormat}Fn`
),
// Uses an EventBridge event payload to test parser functionality
payload: {
version: '0',
id: '6a7e8feb-b491-4cf7-a9f1-bf3703467718',
'detail-type': 'EC2 Instance State-change Notification',
source: 'aws.ec2',
account: '111122223333',
time: '2017-12-22T18:43:48Z',
region: 'us-west-1',
resources: [
'arn:aws:ec2:us-west-1:123456789012:instance/i-1234567890abcdef0',
],
detail: {
instance_id: 'i-1234567890abcdef0',
state: 'terminated',
},
'replay-name': 'replay_archive',
} satisfies EventBridgeEvent<string, unknown>,
})
);
}
Expand Down
Loading