diff --git a/packages/commons/src/samples/resources/contexts/hello-world.ts b/packages/commons/src/samples/resources/contexts/hello-world.ts index 006cae3089..16f707376e 100644 --- a/packages/commons/src/samples/resources/contexts/hello-world.ts +++ b/packages/commons/src/samples/resources/contexts/hello-world.ts @@ -7,8 +7,8 @@ const helloworldContext: Context = { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function-123456abcdef', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', - awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e8deadbeef', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', + awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e812345678', getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), fail: () => console.log('Failed!'), diff --git a/packages/logger/tests/unit/Logger.test.ts b/packages/logger/tests/unit/Logger.test.ts index 6fbf9a527a..42c1d99e72 100644 --- a/packages/logger/tests/unit/Logger.test.ts +++ b/packages/logger/tests/unit/Logger.test.ts @@ -4,27 +4,22 @@ * @group unit/logger/all */ -import { context as dummyContext } from '../../../../tests/resources/contexts/hello-world'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -import * as dummyEvent from '../../../../tests/resources/events/custom/hello-world.json'; +import { ContextExamples as dummyContext, Events as dummyEvent, LambdaInterface } from '@aws-lambda-powertools/commons'; import { createLogger, Logger } from '../../src'; import { EnvironmentVariablesService } from '../../src/config'; import { PowertoolLogFormatter } from '../../src/formatter'; import { ClassThatLogs, LogJsonIndent } from '../../src/types'; -import { Context, Handler } from 'aws-lambda'; +import { Context } from 'aws-lambda'; import { Console } from 'console'; -interface LambdaInterface { - handler: Handler -} - const mockDate = new Date(1466424490000); const dateSpy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate as unknown as string); describe('Class: Logger', () => { const ENVIRONMENT_VARIABLES = process.env; - + const context = dummyContext.helloworldContext; + const event = dummyEvent.Custom.CustomEvent; + beforeEach(() => { dateSpy.mockClear(); process.env = { ...ENVIRONMENT_VARIABLES }; @@ -244,7 +239,7 @@ describe('Class: Logger', () => { const logger: Logger & { addContext: (context: Context) => void } = createLogger({ logLevel: 'DEBUG', }); - logger.addContext(dummyContext); + logger.addContext(context); const consoleSpy = jest.spyOn(logger['console'], methodOfLogger).mockImplementation(); // Act @@ -829,7 +824,7 @@ describe('Class: Logger', () => { } // Act - await new LambdaFunction().handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); // Assess expect(consoleSpy).toBeCalledTimes(1); @@ -865,7 +860,7 @@ describe('Class: Logger', () => { // Act logger.info('An INFO log without context!'); - await new LambdaFunction().handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); // Assess @@ -912,7 +907,7 @@ describe('Class: Logger', () => { // Act logger.info('An INFO log without context!'); - const actualResult = await new LambdaFunction().handler(dummyEvent, dummyContext); + const actualResult = await new LambdaFunction().handler(event, context); // Assess @@ -971,7 +966,7 @@ describe('Class: Logger', () => { const persistentAttribs = { ...logger.getPersistentLogAttributes() }; // Act - await new LambdaFunction().handler({ user_id: '123456' }, dummyContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler({ user_id: '123456' }, context, () => console.log('Lambda invoked!')); const persistentAttribsAfterInvocation = { ...logger.getPersistentLogAttributes() }; // Assess @@ -1017,7 +1012,7 @@ describe('Class: Logger', () => { // Act & Assess const executeLambdaHandler = async (): Promise => { - await new LambdaFunction().handler({ user_id: '123456' }, dummyContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler({ user_id: '123456' }, context, () => console.log('Lambda invoked!')); }; await expect(executeLambdaHandler()).rejects.toThrow('Unexpected error occurred!'); const persistentAttribsAfterInvocation = { ...logger.getPersistentLogAttributes() }; @@ -1050,7 +1045,7 @@ describe('Class: Logger', () => { } // Act - await new LambdaFunction().handler({ user_id: '123456' }, dummyContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler({ user_id: '123456' }, context, () => console.log('Lambda invoked!')); // Assess expect(consoleSpy).toBeCalledTimes(1); @@ -1094,7 +1089,7 @@ describe('Class: Logger', () => { } // Act - await new LambdaFunction().handler({ user_id: '123456' }, dummyContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler({ user_id: '123456' }, context, () => console.log('Lambda invoked!')); // Assess expect(consoleSpy).toBeCalledTimes(1); @@ -1148,7 +1143,7 @@ describe('Class: Logger', () => { // Act const lambda = new LambdaFunction('someValue'); const handler = lambda.handler.bind(lambda); - await handler({}, dummyContext, () => console.log('Lambda invoked!')); + await handler({}, context, () => console.log('Lambda invoked!')); // Assess expect(consoleSpy).toBeCalledTimes(1); @@ -1198,7 +1193,7 @@ describe('Class: Logger', () => { // Act const lambda = new LambdaFunction(); const handler = lambda.handler.bind(lambda); - await handler({}, dummyContext, () => console.log('Lambda invoked!')); + await handler({}, context, () => console.log('Lambda invoked!')); // Assess expect(consoleSpy).toBeCalledTimes(1); @@ -1381,7 +1376,7 @@ describe('Class: Logger', () => { const consoleSpy = jest.spyOn(logger['console'], 'info').mockImplementation(); // Act - logger.logEventIfEnabled(dummyEvent); + logger.logEventIfEnabled(event); // Assess diff --git a/packages/metrics/tests/unit/Metrics.test.ts b/packages/metrics/tests/unit/Metrics.test.ts index b3f0086d70..e6a0e6045a 100644 --- a/packages/metrics/tests/unit/Metrics.test.ts +++ b/packages/metrics/tests/unit/Metrics.test.ts @@ -4,11 +4,8 @@ * @group unit/metrics/class */ -import { ContextExamples as dummyContext, LambdaInterface } from '@aws-lambda-powertools/commons'; +import { ContextExamples as dummyContext, Events as dummyEvent, LambdaInterface } from '@aws-lambda-powertools/commons'; import { Context, Callback } from 'aws-lambda'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -import * as dummyEvent from '../../../../tests/resources/events/custom/hello-world.json'; import { Metrics, MetricUnits } from '../../src/'; import { populateEnvironmentVariables } from '../helpers'; @@ -22,14 +19,10 @@ interface LooseObject { [key: string]: string } -type DummyEvent = { - key1: string - key2: string - key3: string -}; - describe('Class: Metrics', () => { const originalEnvironmentVariables = process.env; + const context = dummyContext.helloworldContext; + const event = dummyEvent.Custom.CustomEvent; beforeEach(() => { consoleSpy.mockClear(); @@ -99,7 +92,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(console.log).toBeCalledTimes(2); @@ -193,7 +186,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(console.log).toBeCalledTimes(2); @@ -227,7 +220,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); } catch (e) { expect((e).message).toBe('Max dimension count hit'); } @@ -255,7 +248,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = JSON.parse(consoleSpy.mock.calls[0][0]); expect(console.log).toBeCalledTimes(1); @@ -283,7 +276,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = JSON.parse(consoleSpy.mock.calls[0][0]); expect(console.log).toBeCalledTimes(1); @@ -297,13 +290,13 @@ describe('Class: Metrics', () => { test('Cold start metric should only be written out once and flushed automatically', async () => { const metrics = new Metrics({ namespace: 'test' }); - const handler = async (_event: DummyEvent, _context: Context): Promise => { + const handler = async (_event: unknown, _context: Context): Promise => { // Should generate only one log metrics.captureColdStartMetric(); }; - await handler(dummyEvent, dummyContext.helloworldContext); - await handler(dummyEvent, dummyContext.helloworldContext); + await handler(event, context); + await handler(event, context); const loggedData = [JSON.parse(consoleSpy.mock.calls[0][0])]; expect(console.log).toBeCalledTimes(1); @@ -329,8 +322,8 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked again!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked again!')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(console.log).toBeCalledTimes(3); @@ -356,7 +349,7 @@ describe('Class: Metrics', () => { metrics.addMetric('test_name', MetricUnits.Seconds, 10); } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = JSON.parse(consoleSpy.mock.calls[0][0]); expect(console.log).toBeCalledTimes(2); @@ -364,7 +357,7 @@ describe('Class: Metrics', () => { expect(loggedData._aws.CloudWatchMetrics[0].Metrics[0].Name).toBe('ColdStart'); expect(loggedData._aws.CloudWatchMetrics[0].Metrics[0].Unit).toBe('Count'); expect(loggedData.service).toBe(serviceName); - expect(loggedData.function_name).toBe(dummyContext.helloworldContext.functionName); + expect(loggedData.function_name).toBe(context.functionName); expect(loggedData._aws.CloudWatchMetrics[0].Dimensions[0]).toContain('service'); expect(loggedData._aws.CloudWatchMetrics[0].Dimensions[0]).toContain('function_name'); expect(loggedData.ColdStart).toBe(1); @@ -373,8 +366,8 @@ describe('Class: Metrics', () => { test('Cold should still log, without a function name', async () => { const serviceName = 'test-service'; const metrics = new Metrics({ namespace: 'test', serviceName: serviceName }); - const newDummyContext = JSON.parse(JSON.stringify(dummyContext)); - delete newDummyContext.functionName; + const newContext = JSON.parse(JSON.stringify(context)); + delete newContext.functionName; class LambdaFunction implements LambdaInterface { @metrics.logMetrics({ captureColdStartMetric: true }) // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -388,7 +381,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, newDummyContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, newContext, () => console.log('Lambda invoked!')); const loggedData = JSON.parse(consoleSpy.mock.calls[0][0]); expect(console.log).toBeCalledTimes(2); @@ -421,7 +414,7 @@ describe('Class: Metrics', () => { } try { - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); } catch (e) { expect((e).message).toBe('The number of metrics recorded must be higher than zero'); } @@ -445,7 +438,7 @@ describe('Class: Metrics', () => { } try { - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); } catch (e) { fail(`Should not throw but got the following Error: ${e}`); } @@ -457,14 +450,14 @@ describe('Class: Metrics', () => { expect.assertions(1); const metrics = new Metrics({ namespace: 'test' }); - const handler = async (_event: DummyEvent, _context: Context): Promise => { + const handler = async (_event: unknown, _context: Context): Promise => { metrics.throwOnEmptyMetrics(); // Logic goes here metrics.publishStoredMetrics(); }; try { - await handler(dummyEvent, dummyContext.helloworldContext); + await handler(event, context); } catch (e) { expect((e).message).toBe('The number of metrics recorded must be higher than zero'); } @@ -490,7 +483,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(console.log).toBeCalledTimes(2); @@ -591,7 +584,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); }); test('Publish Stored Metrics should log and clear', async () => { @@ -610,7 +603,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(console.log).toBeCalledTimes(2); @@ -640,7 +633,7 @@ describe('Class: Metrics', () => { } // Act - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext); + await new LambdaFunction().handler(event, context); // Assess expect(console.log).toBeCalledTimes(1); @@ -669,7 +662,7 @@ describe('Class: Metrics', () => { } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext); + await new LambdaFunction().handler(event, context); const loggedData = JSON.parse(consoleSpy.mock.calls[0][0]); expect(console.log).toBeCalledTimes(1); @@ -695,7 +688,7 @@ describe('Class: Metrics', () => { } try { - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); } catch (error) { // DO NOTHING } @@ -724,7 +717,7 @@ describe('Class: Metrics', () => { metrics.addMetric('test_name', MetricUnits.Seconds, 1); } } - await new LambdaFunction().handler(dummyEvent, dummyContext.helloworldContext, () => console.log('Lambda invoked!')); + await new LambdaFunction().handler(event, context, () => console.log('Lambda invoked!')); const loggedData = JSON.parse(consoleSpy.mock.calls[0][0]); // Assess diff --git a/packages/metrics/tests/unit/middleware/middy.test.ts b/packages/metrics/tests/unit/middleware/middy.test.ts index ced312f1e3..16c284c61e 100644 --- a/packages/metrics/tests/unit/middleware/middy.test.ts +++ b/packages/metrics/tests/unit/middleware/middy.test.ts @@ -6,9 +6,6 @@ import { Metrics, MetricUnits, logMetrics } from '../../../../metrics/src'; import middy from '@middy/core'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -import * as event from '../../../../../tests/resources/events/custom/hello-world.json'; import { ExtraOptions } from '../../../src/types'; const consoleSpy = jest.spyOn(console, 'log').mockImplementation(); @@ -16,6 +13,27 @@ const mockDate = new Date(1466424490000); const dateSpy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate as unknown as string); describe('Middy middleware', () => { + + const dummyEvent = { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }; + const dummyContext = { + callbackWaitsForEmptyEventLoop: true, + functionVersion: '$LATEST', + functionName: 'foo-bar-function', + memoryLimitInMB: '128', + logGroupName: '/aws/lambda/foo-bar-function-123456abcdef', + logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', + awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e812345678', + getRemainingTimeInMillis: () => 1234, + done: () => console.log('Done!'), + fail: () => console.log('Failed!'), + succeed: () => console.log('Succeeded!'), + }; + beforeEach(() => { jest.resetModules(); consoleSpy.mockClear(); @@ -23,23 +41,6 @@ describe('Middy middleware', () => { }); describe('throwOnEmptyMetrics', () => { - const getRandomInt = (): number => Math.floor(Math.random() * 1000000000); - const awsRequestId = getRandomInt().toString(); - - const context = { - callbackWaitsForEmptyEventLoop: true, - functionVersion: '$LATEST', - functionName: 'foo-bar-function', - memoryLimitInMB: '128', - logGroupName: '/aws/lambda/foo-bar-function', - logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', - awsRequestId: awsRequestId, - getRemainingTimeInMillis: () => 1234, - done: () => console.log('Done!'), - fail: () => console.log('Failed!'), - succeed: () => console.log('Succeeded!'), - }; test('should throw on empty metrics if set to true', async () => { // Prepare @@ -52,7 +53,7 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics, { throwOnEmptyMetrics: true })); try { - await handler(event, context, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); } catch (e) { expect((e).message).toBe('The number of metrics recorded must be higher than zero'); } @@ -69,7 +70,7 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics, { throwOnEmptyMetrics: false })); try { - await handler(event, context, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); } catch (e) { fail(`Should not throw but got the following Error: ${e}`); } @@ -86,7 +87,7 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics)); try { - await handler(event, context, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); } catch (e) { fail(`Should not throw but got the following Error: ${e}`); } @@ -94,23 +95,6 @@ describe('Middy middleware', () => { }); describe('captureColdStartMetric', () => { - const getRandomInt = (): number => Math.floor(Math.random() * 1000000000); - const awsRequestId = getRandomInt().toString(); - - const context = { - callbackWaitsForEmptyEventLoop: true, - functionVersion: '$LATEST', - functionName: 'foo-bar-function', - memoryLimitInMB: '128', - logGroupName: '/aws/lambda/foo-bar-function', - logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', - awsRequestId: awsRequestId, - getRemainingTimeInMillis: () => 1234, - done: () => console.log('Done!'), - fail: () => console.log('Failed!'), - succeed: () => console.log('Succeeded!'), - }; test('should capture cold start metric if set to true', async () => { // Prepare @@ -122,8 +106,8 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics, { captureColdStartMetric: true })); - await handler(event, context, () => console.log('Lambda invoked!')); - await handler(event, context, () => console.log('Lambda invoked! again')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked! again')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(console.log).toBeCalledTimes(5); @@ -143,8 +127,8 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics, { captureColdStartMetric: false })); - await handler(event, context, () => console.log('Lambda invoked!')); - await handler(event, context, () => console.log('Lambda invoked! again')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked! again')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(loggedData[0]._aws).toBe(undefined); @@ -160,8 +144,8 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics)); - await handler(event, context, () => console.log('Lambda invoked!')); - await handler(event, context, () => console.log('Lambda invoked! again')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked! again')); const loggedData = [ JSON.parse(consoleSpy.mock.calls[0][0]), JSON.parse(consoleSpy.mock.calls[1][0]) ]; expect(loggedData[0]._aws).toBe(undefined); @@ -169,23 +153,6 @@ describe('Middy middleware', () => { }); describe('logMetrics', () => { - const getRandomInt = (): number => Math.floor(Math.random() * 1000000000); - const awsRequestId = getRandomInt().toString(); - - const context = { - callbackWaitsForEmptyEventLoop: true, - functionVersion: '$LATEST', - functionName: 'foo-bar-function', - memoryLimitInMB: '128', - logGroupName: '/aws/lambda/foo-bar-function', - logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', - awsRequestId: awsRequestId, - getRemainingTimeInMillis: () => 1234, - done: () => console.log('Done!'), - fail: () => console.log('Failed!'), - succeed: () => console.log('Succeeded!'), - }; test('when a metrics instance receive multiple metrics with the same name, it prints multiple values in an array format', async () => { // Prepare @@ -199,7 +166,7 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics)); // Act - await handler(event, context, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); // Assess expect(console.log).toHaveBeenNthCalledWith( @@ -236,7 +203,7 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics, metricsOptions)); // Act - await handler(event, context, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); // Assess expect(console.log).toHaveBeenNthCalledWith( @@ -291,7 +258,7 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics(metrics)); // Act - await handler(event, context, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); // Assess expect(console.log).toHaveBeenNthCalledWith( @@ -326,7 +293,7 @@ describe('Middy middleware', () => { const handler = middy(lambdaHandler).use(logMetrics([metrics], metricsOptions)); // Act - await handler(event, context, () => console.log('Lambda invoked!')); + await handler(dummyEvent, dummyContext, () => console.log('Lambda invoked!')); // Assess expect(console.log).toHaveBeenNthCalledWith( diff --git a/packages/tracer/tests/unit/Tracer.test.ts b/packages/tracer/tests/unit/Tracer.test.ts index f541f2e4db..6a71c93bd0 100644 --- a/packages/tracer/tests/unit/Tracer.test.ts +++ b/packages/tracer/tests/unit/Tracer.test.ts @@ -4,16 +4,13 @@ * @group unit/tracer/all */ +import { ContextExamples as dummyContext, Events as dummyEvent, LambdaInterface } from '@aws-lambda-powertools/commons'; import { Tracer } from '../../src'; -import { Callback, Context, Handler } from 'aws-lambda/handler'; +import { Callback, Context } from 'aws-lambda/handler'; import { Segment, setContextMissingStrategy, Subsegment } from 'aws-xray-sdk-core'; import { DynamoDB } from 'aws-sdk'; import { ProviderServiceInterface } from '../../src/provider'; -interface LambdaInterface { - handler: Handler -} - type CaptureAsyncFuncMock = jest.SpyInstance unknown, parent?: Segment | Subsegment]>; const createCaptureAsyncFuncMock = function(provider: ProviderServiceInterface, subsegment?: Subsegment): CaptureAsyncFuncMock { return jest.spyOn(provider, 'captureAsyncFunc') @@ -32,25 +29,8 @@ jest.spyOn(console, 'error').mockImplementation(() => null); describe('Class: Tracer', () => { const ENVIRONMENT_VARIABLES = process.env; - const event = { - key1: 'value1', - key2: 'value2', - key3: 'value3', - }; - const context = { - callbackWaitsForEmptyEventLoop: true, - functionVersion: '$LATEST', - functionName: 'foo-bar-function', - memoryLimitInMB: '128', - logGroupName: '/aws/lambda/foo-bar-function-123456abcdef', - logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', - awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e8deadbeef', - getRemainingTimeInMillis: () => 1234, - done: () => console.log('Done!'), - fail: () => console.log('Failed!'), - succeed: () => console.log('Succeeded!'), - }; + const context = dummyContext.helloworldContext; + const event = dummyEvent.Custom.CustomEvent; beforeEach(() => { jest.clearAllMocks(); diff --git a/tests/resources/contexts/hello-world.ts b/tests/resources/contexts/hello-world.ts deleted file mode 100644 index dbb23c366d..0000000000 --- a/tests/resources/contexts/hello-world.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Context } from 'aws-lambda'; - -const context: Context = { - callbackWaitsForEmptyEventLoop: true, - functionVersion: '$LATEST', - functionName: 'foo-bar-function', - memoryLimitInMB: '128', - logGroupName: '/aws/lambda/foo-bar-function', - logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', - awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e812345678', - getRemainingTimeInMillis: () => 1234, - done: () => console.log('Done!'), - fail: () => console.log('Failed!'), - succeed: () => console.log('Succeeded!'), -}; - -export { - context -}; \ No newline at end of file diff --git a/tests/resources/events/aws/apigateway-authorizer.json b/tests/resources/events/aws/apigateway-authorizer.json deleted file mode 100644 index 2bbf060353..0000000000 --- a/tests/resources/events/aws/apigateway-authorizer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "TOKEN", - "authorizationToken": "incoming-client-token", - "methodArn": "arn:aws:execute-api:eu-central-1:123456789012:example/prod/POST/{proxy+}" -} \ No newline at end of file diff --git a/tests/resources/events/aws/apigateway-aws-proxy.json b/tests/resources/events/aws/apigateway-aws-proxy.json deleted file mode 100644 index 2369993716..0000000000 --- a/tests/resources/events/aws/apigateway-aws-proxy.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "body": "eyJ0ZXN0IjoiYm9keSJ9", - "resource": "/{proxy+}", - "path": "/path/to/resource", - "httpMethod": "POST", - "isBase64Encoded": true, - "queryStringParameters": { - "foo": "bar" - }, - "multiValueQueryStringParameters": { - "foo": [ - "bar" - ] - }, - "pathParameters": { - "proxy": "/path/to/resource" - }, - "stageVariables": { - "baz": "qux" - }, - "headers": { - "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", - "Accept-Encoding": "gzip, deflate, sdch", - "Accept-Language": "en-US,en;q=0.8", - "Cache-Control": "max-age=0", - "CloudFront-Forwarded-Proto": "https", - "CloudFront-Is-Desktop-Viewer": "true", - "CloudFront-Is-Mobile-Viewer": "false", - "CloudFront-Is-SmartTV-Viewer": "false", - "CloudFront-Is-Tablet-Viewer": "false", - "CloudFront-Viewer-Country": "US", - "Host": "1234567890.execute-api.eu-central-1.amazonaws.com", - "Upgrade-Insecure-Requests": "1", - "User-Agent": "Custom User Agent String", - "Via": "1.1 08f32312345678a7af34d5feb414ce27.cloudfront.net (CloudFront)", - "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", - "X-Forwarded-For": "127.0.0.1, 127.0.0.2", - "X-Forwarded-Port": "443", - "X-Forwarded-Proto": "https" - }, - "multiValueHeaders": { - "Accept": [ - "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" - ], - "Accept-Encoding": [ - "gzip, deflate, sdch" - ], - "Accept-Language": [ - "en-US,en;q=0.8" - ], - "Cache-Control": [ - "max-age=0" - ], - "CloudFront-Forwarded-Proto": [ - "https" - ], - "CloudFront-Is-Desktop-Viewer": [ - "true" - ], - "CloudFront-Is-Mobile-Viewer": [ - "false" - ], - "CloudFront-Is-SmartTV-Viewer": [ - "false" - ], - "CloudFront-Is-Tablet-Viewer": [ - "false" - ], - "CloudFront-Viewer-Country": [ - "US" - ], - "Host": [ - "0123456789.execute-api.eu-central-1.amazonaws.com" - ], - "Upgrade-Insecure-Requests": [ - "1" - ], - "User-Agent": [ - "Custom User Agent String" - ], - "Via": [ - "1.1 08f32312345678a7af34d5feb414ce27.cloudfront.net (CloudFront)" - ], - "X-Amz-Cf-Id": [ - "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==" - ], - "X-Forwarded-For": [ - "127.0.0.1, 127.0.0.2" - ], - "X-Forwarded-Port": [ - "443" - ], - "X-Forwarded-Proto": [ - "https" - ] - }, - "requestContext": { - "accountId": "123456789012", - "resourceId": "123456", - "stage": "prod", - "requestId": "c6af9ac6-7b61-11e6-9a41-93e812345678", - "requestTime": "09/Apr/2015:12:34:56 +0000", - "requestTimeEpoch": 1428582896000, - "identity": { - "cognitoIdentityPoolId": null, - "accountId": null, - "cognitoIdentityId": null, - "caller": null, - "accessKey": null, - "sourceIp": "127.0.0.1", - "cognitoAuthenticationType": null, - "cognitoAuthenticationProvider": null, - "userArn": null, - "userAgent": "Custom User Agent String", - "user": null - }, - "path": "/prod/path/to/resource", - "resourcePath": "/{proxy+}", - "httpMethod": "POST", - "apiId": "1234567890", - "protocol": "HTTP/1.1" - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/appsync-resolver.json b/tests/resources/events/aws/appsync-resolver.json deleted file mode 100644 index 94960dd1ed..0000000000 --- a/tests/resources/events/aws/appsync-resolver.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "arguments": { - "id": "my identifier" - }, - "identity": { - "claims": { - "sub": "192879fc-a240-4bf1-ab5a-d6a00f3063f9", - "email_verified": true, - "iss": "https://cognito-idp.us-west-2.amazonaws.com/us-west-xxxxxxxxxxx", - "phone_number_verified": false, - "cognito:username": "jdoe", - "aud": "7471s60os7h0uu77i1tk27sp9n", - "event_id": "bc334ed8-a938-4474-b644-9547e304e606", - "token_use": "id", - "auth_time": 1599154213, - "phone_number": "+19999999999", - "exp": 1599157813, - "iat": 1599154213, - "email": "jdoe@email.com" - }, - "defaultAuthStrategy": "ALLOW", - "groups": null, - "issuer": "https://cognito-idp.us-west-2.amazonaws.com/us-west-xxxxxxxxxxx", - "sourceIp": [ - "1.1.1.1" - ], - "sub": "192879fc-a240-4bf1-ab5a-d6a00f3063f9", - "username": "jdoe" - }, - "source": null, - "request": { - "headers": { - "x-forwarded-for": "1.1.1.1, 2.2.2.2", - "cloudfront-viewer-country": "US", - "cloudfront-is-tablet-viewer": "false", - "via": "2.0 xxxxxxxxxxxxxxxx.cloudfront.net (CloudFront)", - "cloudfront-forwarded-proto": "https", - "origin": "https://us-west-1.console.aws.amazon.com", - "content-length": "217", - "accept-language": "en-US,en;q=0.9", - "host": "xxxxxxxxxxxxxxxx.appsync-api.us-west-1.amazonaws.com", - "x-forwarded-proto": "https", - "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36", - "accept": "*/*", - "cloudfront-is-mobile-viewer": "false", - "cloudfront-is-smarttv-viewer": "false", - "accept-encoding": "gzip, deflate, br", - "referer": "https://us-west-1.console.aws.amazon.com/appsync/home?region=us-west-1", - "content-type": "application/json", - "sec-fetch-mode": "cors", - "x-amz-cf-id": "3aykhqlUwQeANU-HGY7E_guV5EkNeMMtwyOgiA==", - "x-amzn-trace-id": "Root=1-5f512f51-fac632066c5e848ae714", - "authorization": "eyJraWQiOiJScWFCSlJqYVJlM0hrSnBTUFpIcVRXazNOW...", - "sec-fetch-dest": "empty", - "x-amz-user-agent": "AWS-Console-AppSync/", - "cloudfront-is-desktop-viewer": "true", - "sec-fetch-site": "cross-site", - "x-forwarded-port": "443" - } - }, - "prev": null, - "info": { - "selectionSetList": [ - "id", - "field1", - "field2" - ], - "selectionSetGraphQL": "{\n id\n field1\n field2\n}", - "parentTypeName": "Mutation", - "fieldName": "createSomething", - "variables": {} - }, - "stash": {} -} \ No newline at end of file diff --git a/tests/resources/events/aws/batch-get-job.json b/tests/resources/events/aws/batch-get-job.json deleted file mode 100644 index cf95238fc4..0000000000 --- a/tests/resources/events/aws/batch-get-job.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "jobName": "hello_world", - "jobQueue": "default", - "jobDefinition": "hello_world" -} \ No newline at end of file diff --git a/tests/resources/events/aws/batch-submit-job.json b/tests/resources/events/aws/batch-submit-job.json deleted file mode 100644 index cf95238fc4..0000000000 --- a/tests/resources/events/aws/batch-submit-job.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "jobName": "hello_world", - "jobQueue": "default", - "jobDefinition": "hello_world" -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudformation-create-request.json b/tests/resources/events/aws/cloudformation-create-request.json deleted file mode 100644 index 461752bb16..0000000000 --- a/tests/resources/events/aws/cloudformation-create-request.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "RequestType": "Create", - "ResponseURL": "http://pre-signed-S3-url-for-response", - "StackId": "arn:aws:cloudformation:eu-central-1:123456789012:stack/MyStack/guid", - "RequestId": "unique id for this create request", - "ResourceType": "Custom::TestResource", - "LogicalResourceId": "MyTestResource", - "ResourceProperties": { - "StackName": "MyStack", - "List": [ - "1", - "2", - "3" - ] - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-ab-test.json b/tests/resources/events/aws/cloudfront-ab-test.json deleted file mode 100644 index bdc6b76e2d..0000000000 --- a/tests/resources/events/aws/cloudfront-ab-test.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "user-agent": [ - { - "key": "User-Agent", - "value": "Test Agent" - } - ], - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "cookie": [ - { - "key": "Cookie", - "value": "SomeCookie=1; AnotherOne=A; X-Experiment-Name=B" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-access-request-in-response.json b/tests/resources/events/aws/cloudfront-access-request-in-response.json deleted file mode 100644 index ecb1240549..0000000000 --- a/tests/resources/events/aws/cloudfront-access-request-in-response.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "user-name": [ - { - "key": "User-Name", - "value": "CloudFront" - } - ] - }, - "clientIp": "2001:cdba::3257:9652", - "uri": "/test", - "method": "GET" - }, - "response": { - "status": "200", - "statusDescription": "OK", - "headers": { - "x-cache": [ - { - "key": "X-Cache", - "value": "Hello from Cloudfront" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-http-direct.json b/tests/resources/events/aws/cloudfront-http-direct.json deleted file mode 100644 index 1f13e53dd1..0000000000 --- a/tests/resources/events/aws/cloudfront-http-direct.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "user-agent": [ - { - "key": "User-Agent", - "value": "test-agent" - } - ], - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-modify-querystring.json b/tests/resources/events/aws/cloudfront-modify-querystring.json deleted file mode 100644 index 7485310e94..0000000000 --- a/tests/resources/events/aws/cloudfront-modify-querystring.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "querystring": "auth=test&foo=bar", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "user-agent": [ - { - "key": "User-Agent", - "value": "Test Agent" - } - ], - "user-name": [ - { - "key": "User-Name", - "value": "aws-cloudfront" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-modify-response-header.json b/tests/resources/events/aws/cloudfront-modify-response-header.json deleted file mode 100644 index 8ac2b4bc0f..0000000000 --- a/tests/resources/events/aws/cloudfront-modify-response-header.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "response": { - "status": "200", - "statusDescription": "OK", - "headers": { - "vary": [ - { - "key": "Vary", - "value": "*" - } - ], - "last-modified": [ - { - "key": "Last-Modified", - "value": "2016-11-25" - } - ], - "x-amz-meta-last-modified": [ - { - "key": "X-Amz-Meta-Last-Modified", - "value": "2016-01-01" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-multiple-remote-calls-aggregate-response.json b/tests/resources/events/aws/cloudfront-multiple-remote-calls-aggregate-response.json deleted file mode 100644 index 1360629d73..0000000000 --- a/tests/resources/events/aws/cloudfront-multiple-remote-calls-aggregate-response.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/forecast/Seattle:NewYork:Chicago:SanFrancisco", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "user-agent": [ - { - "key": "User-Agent", - "value": "Test Agent" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-normalize-querystring-to-improve-cache-hit.json b/tests/resources/events/aws/cloudfront-normalize-querystring-to-improve-cache-hit.json deleted file mode 100644 index 21100c997a..0000000000 --- a/tests/resources/events/aws/cloudfront-normalize-querystring-to-improve-cache-hit.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "querystring": "size=LARGE&color=RED", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "user-agent": [ - { - "key": "User-Agent", - "value": "Test Agent" - } - ], - "user-name": [ - { - "key": "User-Name", - "value": "aws-cloudfront" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-redirect-on-viewer-country.json b/tests/resources/events/aws/cloudfront-redirect-on-viewer-country.json deleted file mode 100644 index 2d24b0cb43..0000000000 --- a/tests/resources/events/aws/cloudfront-redirect-on-viewer-country.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "cloudfront-viewer-country": [ - { - "key": "CloudFront-Viewer-Country", - "value": "TW" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-redirect-unauthenticated-users.json b/tests/resources/events/aws/cloudfront-redirect-unauthenticated-users.json deleted file mode 100644 index 4d064cfd0c..0000000000 --- a/tests/resources/events/aws/cloudfront-redirect-unauthenticated-users.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "method": "GET", - "querystring": "foo=bar", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-response-generation.json b/tests/resources/events/aws/cloudfront-response-generation.json deleted file mode 100644 index 2bfde0f0d6..0000000000 --- a/tests/resources/events/aws/cloudfront-response-generation.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-serve-object-on-viewer-device.json b/tests/resources/events/aws/cloudfront-serve-object-on-viewer-device.json deleted file mode 100644 index f1f50a8980..0000000000 --- a/tests/resources/events/aws/cloudfront-serve-object-on-viewer-device.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "cloudfront-is-desktop-viewer": [ - { - "key": "CloudFront-Is-Desktop-Viewer", - "value": "true" - } - ], - "cloudfront-is-mobile-viewer": [ - { - "key": "CloudFront-Is-Mobile-Viewer", - "value": "false" - } - ], - "cloudfront-is-smarttv-viewer": [ - { - "key": "CloudFront-Is-SmartTV-Viewer", - "value": "false" - } - ], - "cloudfront-is-tablet-viewer": [ - { - "key": "CloudFront-Is-Tablet-Viewer", - "value": "false" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudfront-simple-remote-call.json b/tests/resources/events/aws/cloudfront-simple-remote-call.json deleted file mode 100644 index bf4625d06d..0000000000 --- a/tests/resources/events/aws/cloudfront-simple-remote-call.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Records": [ - { - "cf": { - "config": { - "distributionId": "EXAMPLE" - }, - "request": { - "uri": "/test", - "method": "GET", - "clientIp": "2001:cdba::3257:9652", - "headers": { - "host": [ - { - "key": "Host", - "value": "d123.cf.net" - } - ], - "user-agent": [ - { - "key": "User-Agent", - "value": "Test Agent" - } - ], - "user-name": [ - { - "key": "User-Name", - "value": "aws-cloudfront" - } - ] - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudwatch-logs.json b/tests/resources/events/aws/cloudwatch-logs.json deleted file mode 100644 index 2b455b9bc4..0000000000 --- a/tests/resources/events/aws/cloudwatch-logs.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "awslogs": { - "data": "H4sIAAAAAAAAAHWPwQqCQBCGX0Xm7EFtK+smZBEUgXoLCdMhFtKV3akI8d0bLYmibvPPN3wz00CJxmQnTO41whwWQRIctmEcB6sQbFC3CjW3XW8kxpOpP+OC22d1Wml1qZkQGtoMsScxaczKN3plG8zlaHIta5KqWsozoTYw3/djzwhpLwivWFGHGpAFe7DL68JlBUk+l7KSN7tCOEJ4M3/qOI49vMHj+zCKdlFqLaU2ZHV2a4Ct/an0/ivdX8oYc1UVX860fQDQiMdxRQEAAA==" - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/cloudwatch-scheduled-event.json b/tests/resources/events/aws/cloudwatch-scheduled-event.json deleted file mode 100644 index dfa0a04b5a..0000000000 --- a/tests/resources/events/aws/cloudwatch-scheduled-event.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "cdc73f9d-aea9-11e3-9d5a-835b769c0d9c", - "detail-type": "Scheduled Event", - "source": "aws.events", - "account": "123456789012", - "time": "1970-01-01T00:00:00Z", - "region": "eu-central-1", - "resources": [ - "arn:aws:events:eu-central-1:123456789012:rule/ExampleRule" - ], - "detail": {} -} \ No newline at end of file diff --git a/tests/resources/events/aws/codecommit-repository.json b/tests/resources/events/aws/codecommit-repository.json deleted file mode 100644 index b30c7c6faa..0000000000 --- a/tests/resources/events/aws/codecommit-repository.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "Records": [ - { - "awsRegion": "eu-central-1", - "codecommit": { - "references": [ - { - "commit": "5c4ef1049f1d2712345678f313e0730018be182b", - "ref": "refs/heads/master" - } - ] - }, - "customData": "this is custom data", - "eventId": "5a824061-17ca-46a9-bbf9-114e12345678", - "eventName": "TriggerEventTest", - "eventPartNumber": 1, - "eventSource": "aws:codecommit", - "eventSourceARN": "arn:aws:codecommit:eu-central-1:123456789012:my-repo", - "eventTime": "2016-01-01T23:59:59.000+0000", - "eventTotalParts": 1, - "eventTriggerConfigId": "5a824061-17ca-46a9-bbf9-114e12345678", - "eventTriggerName": "my-trigger", - "eventVersion": "1.0", - "userIdentityARN": "arn:aws:iam::123456789012:root" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/codepipeline-job.json b/tests/resources/events/aws/codepipeline-job.json deleted file mode 100644 index 13763cfadf..0000000000 --- a/tests/resources/events/aws/codepipeline-job.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "CodePipeline.job": { - "data": { - "artifactCredentials": { - "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", - "sessionToken": "token", - "accessKeyId": "AKIAIOSFODNN7EXAMPLE" - }, - "actionConfiguration": { - "configuration": { - "FunctionName": "my-function", - "UserParameters": "user-parameter-string" - } - }, - "inputArtifacts": [ - { - "revision": "ca2b123456787d1932acb4977e08c803295d9896", - "name": "input-artifact", - "location": { - "type": "S3", - "s3Location": { - "objectKey": "test/key", - "bucketName": "example-bucket" - } - } - } - ], - "outputArtifacts": [ - { - "revision": null, - "name": "output-artifact", - "location": { - "type": "S3", - "s3Location": { - "objectKey": "test/key2", - "bucketName": "example-bucket2" - } - } - } - ] - }, - "id": "c968ef10-6415-4127-80b1-42502218a8c7", - "accountId": "123456789012" - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/cognito-sync-trigger.json b/tests/resources/events/aws/cognito-sync-trigger.json deleted file mode 100644 index e9c7a0ddd0..0000000000 --- a/tests/resources/events/aws/cognito-sync-trigger.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": 2, - "eventType": "SyncTrigger", - "region": "eu-central-1", - "identityPoolId": "identityPoolId", - "identityId": "identityId", - "datasetName": "datasetName", - "datasetRecords": { - "SampleKey1": { - "oldValue": "oldValue1", - "newValue": "newValue1", - "op": "replace" - }, - "SampleKey2": { - "oldValue": "oldValue2", - "newValue": "newValue2", - "op": "replace" - } - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/config-oversized-item-change-notification.json b/tests/resources/events/aws/config-oversized-item-change-notification.json deleted file mode 100644 index fb20d98bb7..0000000000 --- a/tests/resources/events/aws/config-oversized-item-change-notification.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "invokingEvent": "{\"configurationItemSummary\": {\"changeType\": \"UPDATE\",\"configurationItemVersion\": \"1.2\",\"configurationItemCaptureTime\":\"2016-10-06T16:46:16.261Z\",\"configurationStateId\": 0,\"awsAccountId\":\"123456789012\",\"configurationItemStatus\": \"OK\",\"resourceType\": \"AWS::EC2::Instance\",\"resourceId\":\"i-00000000\",\"resourceName\":null,\"ARN\":\"arn:aws:ec2:eu-central-1:123456789012:instance/i-00000000\",\"awsRegion\": \"eu-central-1\",\"availabilityZone\":\"eu-central-1\",\"configurationStateMd5Hash\":\"8f1ee69b287895a0f8bc5753eca68e96\",\"resourceCreationTime\":\"2016-10-06T16:46:10.489Z\"},\"messageType\":\"OversizedConfigurationItemChangeNotification\"}", - "ruleParameters": "{\"\":\"\"}", - "resultToken": "myResultToken", - "eventLeftScope": false, - "executionRoleArn": "arn:aws:iam::123456789012:role/config-role", - "configRuleArn": "arn:aws:config:eu-central-1:123456789012:config-rule/config-rule-0123456", - "configRuleName": "change-triggered-config-rule", - "configRuleId": "config-rule-0123456", - "accountId": "123456789012", - "version": "1.0" -} \ No newline at end of file diff --git a/tests/resources/events/aws/config-periodic-rule.json b/tests/resources/events/aws/config-periodic-rule.json deleted file mode 100644 index 03322a8b12..0000000000 --- a/tests/resources/events/aws/config-periodic-rule.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "invokingEvent": "{\"awsAccountId\":\"123456789012\",\"notificationCreationTime\":\"1970-01-01T00:00:00.0Z\",\"messageType\":\"ScheduledNotification\",\"recordVersion\":\"1.0\"}", - "ruleParameters": "{\"myParameterKey\":\"myParameterValue\"}", - "resultToken": "myResultToken", - "eventLeftScope": false, - "executionRoleArn": "arn:aws:iam::123456789012:role/config-role", - "configRuleArn": "arn:aws:config:eu-central-1:123456789012:config-rule/config-rule-0123456", - "configRuleName": "periodic-config-rule", - "configRuleId": "config-rule-0123456", - "accountId": "123456789012", - "version": "1.0" -} \ No newline at end of file diff --git a/tests/resources/events/aws/confit-item-change-notification.json b/tests/resources/events/aws/confit-item-change-notification.json deleted file mode 100644 index cf79568736..0000000000 --- a/tests/resources/events/aws/confit-item-change-notification.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "invokingEvent": "{\"configurationItem\":{\"configurationItemCaptureTime\":\"2016-10-06T16:46:16.261Z\",\"awsAccountId\":\"123456789012\",\"configurationItemStatus\":\"OK\",\"resourceId\":\"i-00000000\",\"resourceName\":\"foo\",\"configurationStateMd5Hash\":\"8f1ee69b297895a0f8bc5753eca68e96\",\"resourceCreationTime\":\"2016-10-06T16:46:10.489Z\",\"configurationStateId\":0,\"configurationItemVersion\":\"1.2\",\"ARN\":\"arn:aws:ec2:eu-central-1:123456789012:instance/i-00000000\",\"awsRegion\":\"eu-central-1\",\"availabilityZone\":\"eu-central-1\",\"resourceType\":\"AWS::EC2::Instance\",\"tags\":{\"\":\"\"},\"relationships\":[{\"resourceId\":\"eipalloc-00000000\",\"resourceType\":\"AWS::EC2::EIP\",\"name\":\"Is attached to ElasticIp\"}],\"configuration\":{\"\":\"\"}},\"messageType\":\"ConfigurationItemChangeNotification\"}", - "ruleParameters": "{\"\":\"\"}", - "resultToken": "myResultToken", - "eventLeftScope": false, - "executionRoleArn": "arn:aws:iam::123456789012:role/config-role", - "configRuleArn": "arn:aws:config:eu-central-1:123456789012:config-rule/config-rule-0123456", - "configRuleName": "change-triggered-config-rule", - "configRuleId": "config-rule-0123456", - "accountId": "123456789012", - "version": "1.0" -} \ No newline at end of file diff --git a/tests/resources/events/aws/connect-contact-flow-event.json b/tests/resources/events/aws/connect-contact-flow-event.json deleted file mode 100644 index b192be3150..0000000000 --- a/tests/resources/events/aws/connect-contact-flow-event.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "Name": "ContactFlowEvent", - "Details": { - "ContactData": { - "Attributes": {}, - "Channel": "VOICE", - "ContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "CustomerEndpoint": { - "Address": "+11234567890", - "Type": "TELEPHONE_NUMBER" - }, - "InitialContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "InitiationMethod": "API", - "InstanceARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa", - "MediaStreams": { - "Customer": { - "Audio": { - "StartFragmentNumber": "91343852333181432392682062622220590765191907586", - "StartTimestamp": "1565781909613", - "StreamARN": "arn:aws:kinesisvideo:eu-central-1:123456789012:stream/connect-contact-a3d73b84-ce0e-479a-a9dc-5637c9d30ac9/1565272947806" - } - } - }, - "PreviousContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "Queue": null, - "SystemEndpoint": { - "Address": "+11234567890", - "Type": "TELEPHONE_NUMBER" - } - }, - "Parameters": {} - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/dynamodb-update-2.json b/tests/resources/events/aws/dynamodb-update-2.json deleted file mode 100644 index c7f8ca2795..0000000000 --- a/tests/resources/events/aws/dynamodb-update-2.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "Records": [ - { - "eventID": "1", - "eventVersion": "1.0", - "dynamodb": { - "Keys": { - "Id": { - "N": "101" - } - }, - "NewImage": { - "Message": { - "S": "New item!" - }, - "Id": { - "N": "101" - } - }, - "StreamViewType": "NEW_AND_OLD_IMAGES", - "SequenceNumber": "111", - "SizeBytes": 26 - }, - "awsRegion": "eu-central-1", - "eventName": "INSERT", - "eventSourceARN": "arn:aws:dynamodb:eu-central-1:account-id:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899", - "eventSource": "aws:dynamodb" - }, - { - "eventID": "2", - "eventVersion": "1.0", - "dynamodb": { - "OldImage": { - "Message": { - "S": "New item!" - }, - "Id": { - "N": "101" - } - }, - "SequenceNumber": "222", - "Keys": { - "Id": { - "N": "101" - } - }, - "SizeBytes": 59, - "NewImage": { - "Message": { - "S": "This item has changed" - }, - "Id": { - "N": "101" - } - }, - "StreamViewType": "NEW_AND_OLD_IMAGES" - }, - "awsRegion": "eu-central-1", - "eventName": "MODIFY", - "eventSourceARN": "arn:aws:dynamodb:eu-central-1:account-id:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899", - "eventSource": "aws:dynamodb" - }, - { - "eventID": "3", - "eventVersion": "1.0", - "dynamodb": { - "Keys": { - "Id": { - "N": "101" - } - }, - "SizeBytes": 38, - "SequenceNumber": "333", - "OldImage": { - "Message": { - "S": "This item has changed" - }, - "Id": { - "N": "101" - } - }, - "StreamViewType": "NEW_AND_OLD_IMAGES" - }, - "awsRegion": "eu-central-1", - "eventName": "REMOVE", - "eventSourceARN": "arn:aws:dynamodb:eu-central-1:account-id:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899", - "eventSource": "aws:dynamodb" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/dynamodb-update.json b/tests/resources/events/aws/dynamodb-update.json deleted file mode 100644 index f59d46c645..0000000000 --- a/tests/resources/events/aws/dynamodb-update.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "Records": [ - { - "eventID": "c4ca4238a0b923820dcc509a6f75849b", - "eventName": "INSERT", - "eventVersion": "1.1", - "eventSource": "aws:dynamodb", - "awsRegion": "eu-central-1", - "dynamodb": { - "Keys": { - "Id": { - "N": "101" - } - }, - "NewImage": { - "Message": { - "S": "New item!" - }, - "Id": { - "N": "101" - } - }, - "ApproximateCreationDateTime": 1428537600, - "SequenceNumber": "4421584500000000017450439091", - "SizeBytes": 26, - "StreamViewType": "NEW_AND_OLD_IMAGES" - }, - "eventSourceARN": "arn:aws:dynamodb:eu-central-1:123456789012:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899" - }, - { - "eventID": "c81e728d9d4c2f636f067f89cc14862c", - "eventName": "MODIFY", - "eventVersion": "1.1", - "eventSource": "aws:dynamodb", - "awsRegion": "eu-central-1", - "dynamodb": { - "Keys": { - "Id": { - "N": "101" - } - }, - "NewImage": { - "Message": { - "S": "This item has changed" - }, - "Id": { - "N": "101" - } - }, - "OldImage": { - "Message": { - "S": "New item!" - }, - "Id": { - "N": "101" - } - }, - "ApproximateCreationDateTime": 1428537600, - "SequenceNumber": "4421584500000000017450439092", - "SizeBytes": 59, - "StreamViewType": "NEW_AND_OLD_IMAGES" - }, - "eventSourceARN": "arn:aws:dynamodb:eu-central-1:123456789012:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899" - }, - { - "eventID": "eccbc87e4b5ce2fe28308fd9f2a7baf3", - "eventName": "REMOVE", - "eventVersion": "1.1", - "eventSource": "aws:dynamodb", - "awsRegion": "eu-central-1", - "dynamodb": { - "Keys": { - "Id": { - "N": "101" - } - }, - "OldImage": { - "Message": { - "S": "This item has changed" - }, - "Id": { - "N": "101" - } - }, - "ApproximateCreationDateTime": 1428537600, - "SequenceNumber": "4421584500000000017450439093", - "SizeBytes": 38, - "StreamViewType": "NEW_AND_OLD_IMAGES" - }, - "eventSourceARN": "arn:aws:dynamodb:eu-central-1:123456789012:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-analytics-compressed.json b/tests/resources/events/aws/kinesis-analytics-compressed.json deleted file mode 100644 index b6c3a539d5..0000000000 --- a/tests/resources/events/aws/kinesis-analytics-compressed.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "invocationId": "invocationIdExample", - "applicationArn": "arn:aws:kinesisanalytics:eu-central-1:123456789012:application/example-application", - "streamArn": "arn:aws:kinesis:eu-central-1:123456789012:stream/example-stream", - "records": [ - { - "recordId": "49571347871967966406409637155186850213682522142927749122", - "data": "H4sIAAAAAAAA/6vmUspLzE1VslLKTsxNzFHS4VJKTEkpSi0uBgol5SRmKHHVAgDd1tysJAAAAA==" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-analytics-dynamodb.json b/tests/resources/events/aws/kinesis-analytics-dynamodb.json deleted file mode 100644 index 8d45307cac..0000000000 --- a/tests/resources/events/aws/kinesis-analytics-dynamodb.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "invocationId": "invocationIdExample", - "applicationArn": "arn:aws:kinesisanalytics:eu-central-1:123456789012:application/example-application", - "streamArn": "arn:aws:kinesis:eu-central-1:123456789012:stream/example-stream", - "records": [ - { - "recordId": "49571347871967966406409637155186850213682522142927749122", - "data": "eyJST1dUSU1FX1RJTUVTVEFNUCI6IjIwMTctMTItMTUgMDE6MDk6NTAuMDAwIiwiVkVISUNMRUlEIjoiNSIsIlZFSElDTEVDT1VOVCI6MTh9" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-analytics-kpl.json b/tests/resources/events/aws/kinesis-analytics-kpl.json deleted file mode 100644 index 807467ead1..0000000000 --- a/tests/resources/events/aws/kinesis-analytics-kpl.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "invocationId": "invocationIdExample", - "applicationArn": "arn:aws:kinesisanalytics:eu-central-1:123456789012:application/example-application", - "streamArn": "arn:aws:kinesis:eu-central-1:123456789012:stream/example-stream", - "records": [ - { - "recordId": "49571347871967966406409637155186850213682522142927749122", - "kinesisStreamRecordMetadata": { - "shardId": "shardId-000000000001", - "partitionKey": "partitionKey-01", - "approximateArrivalTimestamp": 1505169657117, - "sequenceNumber": "49571347871967966406409637155186850213682522142927749122" - }, - "data": "84mawgoNMTUwNTE2OTY0NTI1MBIlODYwOTcwOTY1NTE0NjQwMzU1MjIwNTI5MjgyNDk2MzU3MTUzNxImNzk1MTM3MTQxMzM4MTE5NTU1OTExMzA1ODMxNDEyOTg2NTM2OTgaiAEIABAAGoEBNDAsYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEKGogBCAAQARqBATQxLGFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhCkU/elbPye5g1wGkAmxGCNg=" - }, - { - "recordId": "49571347871967966406409637141563465152445265354688561154", - "kinesisStreamRecordMetadata": { - "shardId": "shardId-000000000002", - "partitionKey": "partitionKey-02", - "approximateArrivalTimestamp": 1505169647777, - "sequenceNumber": "49571347871967966406409637141563465152445265354688561154" - }, - "data": "NCxhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEK" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-analytics.json b/tests/resources/events/aws/kinesis-analytics.json deleted file mode 100644 index 7f1db565b1..0000000000 --- a/tests/resources/events/aws/kinesis-analytics.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "invocationId": "invocationIdExample", - "applicationArn": "arn:aws:kinesisanalytics:eu-central-1:123456789012:application/example-application", - "streamArn": "arn:aws:kinesis:eu-central-1:123456789012:stream/example-stream", - "records": [ - { - "recordId": "49571347871967966406409637155186850213682522142927749122", - "data": "VGhpcyBpcyBhIHRlc3QgZnJvbSBLaW5lc2lzIEFuYWx5dGljcw==" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-apachelog.json b/tests/resources/events/aws/kinesis-apachelog.json deleted file mode 100644 index 3f917a1613..0000000000 --- a/tests/resources/events/aws/kinesis-apachelog.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "invocationId": "invocationIdExample", - "region": "eu-central-1", - "records": [ - { - "recordId": "49546986683135544286507457936321625675700192471156785154", - "approximateArrivalTimestamp": 1495072949453, - "data": "NjQuMjQyLjg4LjEwIC0gLSBbMDcvTWFyLzIwMDQ6MTY6MTA6MDIgLTA4MDBdICJHRVQgL21haWxtYW4vbGlzdGluZm8vaHNkaXZpc2lvbiBIVFRQLzEuMSIgMjAwIDYyOTE==" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-cloudwatch-logs-processor.json b/tests/resources/events/aws/kinesis-cloudwatch-logs-processor.json deleted file mode 100644 index c7978af868..0000000000 --- a/tests/resources/events/aws/kinesis-cloudwatch-logs-processor.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "records": [ - { - "recordId": "49578734086442259037497492980620233840400173390482112514000000", - "data": "H4sIAAAAAAAAADWO0QqCMBiFX2XsWiJFi7wLUW8sIYUuQmLpnxvpJttMQnz3Ztrlxzmc8424BaVIDfmnA+zjID3nlzS5n8IsO8YhtrAYOMg5aURfDUSXNBG1MkEj6liKvjPZQpmWQNoFVf9QpWSdZoJHrNEgFfZvxa8XvoHrGUfMqqWumdHQpDVjtmdvHc91dwdn71p/vVngmqBVD616PgoolC/Ga0SBNJoi8USVWWKczM8oYhKoULDBUzF9Aeua5yHsAAAA", - "approximateArrivalTimestamp": 1510254469499 - }, - { - "recordId": "49578734086442259037497492980621442766219788363254202370000000", - "data": "H4sIAAAAAAAAAJWRTWsbMRCG/8ueLZjRjL5yc9NNLnZDapemlFAkrTYstb3Lep0Qgv97x00KgTSHnAQzmkeP3nmqtmW/j3dl/TiU6qz6PF/Pfy3r1Wp+WVezqn/YlVHK2pK3Hr0Jxkt5099djv1hkE7uh0eVHzZqE7epiarb3fe/ixzDYVJoELRhssYQqsXLlEJ3jd8//biy4QYWz7jVNJa4/TDveQwV+qsada0v/HnthLg/pH0eu2Hq+t1Ft5nKuK/Ofn4EvnpDUAu7Xi6/LL9en3/z1e1f7fq+7KYT+qnqGrEnsi54AGS2wbHWxjCjoWAYGawmzawByIG3Dp0JzjOxsaI8dbKJKW4l1BcTdgg+zP5tSPCeQ/Bso/I+o+I2kUptjgrRlQyasslUHWdvZRwGJ4+HYJGCtiKgQTYKSJ4gODLgAkpFk3f0rkyA1zLGSsvoVsVCRTFakUkNqKxt1IyFc8T/y0gEmoHZo5a/W9HhU0TeWHMyIJaoQC6zDvC+DL6WSW3MqZSkiolJcWoalWybJSNIJTXcRgjV8fb4BwwLrNzwAgAA", - "approximateArrivalTimestamp": 1510254473773 - }, - { - "recordId": "49578734086442259037497492980622651692039402992428908546000000", - "data": "H4sIAAAAAAAAAJWRbWsbMQyA/8t9jkGSJdnut2zLCiXZyJKyZaMM352vHEty4e7SUkr++9yXwUbXD8Vgg2w9eizdF7s0DPE6re8OqTgrPkzX05+L2Wo1PZ8Vk6K73ac+h0mtV49egvgc3nbX5313POSbqjvcmep2a7ZxV9bRtPub7lfKx+E4GhQEErYqYtHMn7MMuiV+fbf5rOEbzJ9wq7FPcfdm3lOaNReXyws/3cw2fvk9A4djOVR9exjbbv+x3Y6pH4qzH29hr14QzFzXi8WnxZfl+0tfXD1az27SfnxA3xdtneWtVRc8ADJrcEwkwoxigzAyiBNxzkJuIxGrei+g3gbgrDy2eRBj3OWePpuwQ/Bh8mdAGR+J69pJMFXKihwTGJ+aYJArpkjYQB2K0+SljMPgyFIIijaQgs2BAMEyexbns1NeoqpsCV+VCfCPTOVLLgUMU4h5S5UpE4BRm6ROqCEF/r8MExBDro3ED0XBMigFVM0iQlkRvZLml9a/LoN/yzSYKoIKTOmVTf6VNTHZxkjTIElkqlCL09XpN5PgkxrvAgAA", - "approximateArrivalTimestamp": 1510254474027 - }, - { - "recordId": "49578734086442259037497492980623860617859017621603614722000000", - "data": "H4sIAAAAAAAAAJWRW28aQQyF/8s+M9J47LHHeaMtzUOhEQXSVlVUDctstCqwCJZEUcR/r3OpFCnNQ17mcjw+8+n4vtqUwyFfl/ndrlRn1afhfPh7MprNhuejalB1t9uyNzkwJk6QosZk8rq7Pt93x51V6m535+rbtVvnzXKVXbu96f4U23bH3kEEHyIhx4jgxs9dDmQK3z/8vGD94cdPdrN+X/Lm3X5PbcHp5QLkYrqYLC6/mOHhuDzU+3bXt932c7vuy/5Qnf16j/fslYMb83wy+Tr5Nv24SNXVI/Xopmz7B+v7ql0ZPCKLJu+BiFUohBiJIKJGAvIkSTgpsU8aVBNangymsCH3rQ2izxvL9JmEBOzh4N+AzL6gX3JD7CLn4kg8OiVduahNkIa0BtbqNHgNI6AS0P5kQA3sUcA4IDCElCBKwgdgiCoI+CaM+pcwbAVfN8F5r2owGV0OdpWkS8kp52a1/D8MBR8sDUoQKDIbDnqlhAgQLTMWz8YbRQT92zDwEkbIQ10YHUZbKGfvUmrAIWodih2btKpOV6e/zXGIX+8CAAA=", - "approximateArrivalTimestamp": 1510254474388 - } - ], - "region": "eu-central-1", - "deliveryStreamArn": "arn:aws:firehose:eu-central-1:123456789012:deliverystream/copy-cwl-lambda-invoke-input-151025436553-Firehose-8KILJ01Q5OBN", - "invocationId": "a7234216-12b6-4bc0-96d7-82606c0e80cf" -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-get-records.json b/tests/resources/events/aws/kinesis-get-records.json deleted file mode 100644 index 12abdabd3c..0000000000 --- a/tests/resources/events/aws/kinesis-get-records.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Records": [ - { - "kinesis": { - "partitionKey": "partitionKey-03", - "kinesisSchemaVersion": "1.0", - "data": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IDEyMy4=", - "sequenceNumber": "49545115243490985018280067714973144582180062593244200961", - "approximateArrivalTimestamp": 1428537600 - }, - "eventSource": "aws:kinesis", - "eventID": "shardId-000000000000:49545115243490985018280067714973144582180062593244200961", - "invokeIdentityArn": "arn:aws:iam::EXAMPLE", - "eventVersion": "1.0", - "eventName": "aws:kinesis:record", - "eventSourceARN": "arn:aws:kinesis:EXAMPLE", - "awsRegion": "eu-central-1" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-kinesis-firehose.json b/tests/resources/events/aws/kinesis-kinesis-firehose.json deleted file mode 100644 index df23583934..0000000000 --- a/tests/resources/events/aws/kinesis-kinesis-firehose.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "invocationId": "invocationIdExample", - "deliveryStreamArn": "arn:aws:kinesis:EXAMPLE", - "region": "eu-central-1", - "records": [ - { - "recordId": "49546986683135544286507457936321625675700192471156785154", - "approximateArrivalTimestamp": 1495072949453, - "data": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IDEyMy4=" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-streams-source.json b/tests/resources/events/aws/kinesis-streams-source.json deleted file mode 100644 index a462dc7e07..0000000000 --- a/tests/resources/events/aws/kinesis-streams-source.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "invocationId": "invocationIdExample", - "deliverySteamArn": "arn:aws:kinesis:EXAMPLE", - "region": "eu-central-1", - "records": [ - { - "recordId": "49546986683135544286507457936321625675700192471156785154", - "approximateArrivalTimestamp": 1495072949453, - "kinesisRecordMetadata": { - "sequenceNumber": "49545115243490985018280067714973144582180062593244200961", - "subsequenceNumber": "123456", - "partitionKey": "partitionKey-03", - "shardId": "shardId-000000000000", - "approximateArrivalTimestamp": 1495072949453 - }, - "data": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IDEyMy4=" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/kinesis-syslog.json b/tests/resources/events/aws/kinesis-syslog.json deleted file mode 100644 index bac8ff5567..0000000000 --- a/tests/resources/events/aws/kinesis-syslog.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "invocationId": "fir", - "region": "eu-central-1", - "records": [ - { - "recordId": "49546986683135544286507457936321625675700192471156785154", - "approximateArrivalTimestamp": 1495072949453, - "data": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IDEyMy4=" - }, - { - "recordId": "49546986683135544286507457936321625675700192471156785154", - "approximateArrivalTimestamp": "2012-04-23T18:25:43.511Z", - "data": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IDEyMy4=" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/rekognition-s3-request.json b/tests/resources/events/aws/rekognition-s3-request.json deleted file mode 100644 index 89e0bd312c..0000000000 --- a/tests/resources/events/aws/rekognition-s3-request.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "Records": [ - { - "eventVersion": "2.0", - "eventSource": "aws:s3", - "awsRegion": "eu-central-1", - "eventTime": "1970-01-01T00:00:00.000Z", - "eventName": "ObjectCreated:Put", - "userIdentity": { - "principalId": "EXAMPLE" - }, - "requestParameters": { - "sourceIPAddress": "127.0.0.1" - }, - "responseElements": { - "x-amz-request-id": "EXAMPLE123456789", - "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" - }, - "s3": { - "s3SchemaVersion": "1.0", - "configurationId": "testConfigRule", - "bucket": { - "name": "example-bucket", - "ownerIdentity": { - "principalId": "EXAMPLE" - }, - "arn": "arn:aws:s3:::example-bucket" - }, - "object": { - "key": "test/key", - "size": 1024, - "eTag": "0123456789abcdef0123456789abcdef", - "sequencer": "0A1B2C3D4E5F678901" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/s3-delete.json b/tests/resources/events/aws/s3-delete.json deleted file mode 100644 index fd30611694..0000000000 --- a/tests/resources/events/aws/s3-delete.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Records": [ - { - "eventVersion": "2.0", - "eventSource": "aws:s3", - "awsRegion": "eu-central-1", - "eventTime": "1970-01-01T00:00:00.000Z", - "eventName": "ObjectRemoved:Delete", - "userIdentity": { - "principalId": "EXAMPLE" - }, - "requestParameters": { - "sourceIPAddress": "127.0.0.1" - }, - "responseElements": { - "x-amz-request-id": "EXAMPLE123456789", - "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" - }, - "s3": { - "s3SchemaVersion": "1.0", - "configurationId": "testConfigRule", - "bucket": { - "name": "example-bucket", - "ownerIdentity": { - "principalId": "EXAMPLE" - }, - "arn": "arn:aws:s3:::example-bucket" - }, - "object": { - "key": "test/key", - "sequencer": "0A1B2C3D4E5F678901" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/s3-put.json b/tests/resources/events/aws/s3-put.json deleted file mode 100644 index 89e0bd312c..0000000000 --- a/tests/resources/events/aws/s3-put.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "Records": [ - { - "eventVersion": "2.0", - "eventSource": "aws:s3", - "awsRegion": "eu-central-1", - "eventTime": "1970-01-01T00:00:00.000Z", - "eventName": "ObjectCreated:Put", - "userIdentity": { - "principalId": "EXAMPLE" - }, - "requestParameters": { - "sourceIPAddress": "127.0.0.1" - }, - "responseElements": { - "x-amz-request-id": "EXAMPLE123456789", - "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" - }, - "s3": { - "s3SchemaVersion": "1.0", - "configurationId": "testConfigRule", - "bucket": { - "name": "example-bucket", - "ownerIdentity": { - "principalId": "EXAMPLE" - }, - "arn": "arn:aws:s3:::example-bucket" - }, - "object": { - "key": "test/key", - "size": 1024, - "eTag": "0123456789abcdef0123456789abcdef", - "sequencer": "0A1B2C3D4E5F678901" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/sagemaker-ground-truth-annotation-consolidation.json b/tests/resources/events/aws/sagemaker-ground-truth-annotation-consolidation.json deleted file mode 100644 index 2aeb4fbbce..0000000000 --- a/tests/resources/events/aws/sagemaker-ground-truth-annotation-consolidation.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": "2018-10-16", - "labelingJobArn": "arn:aws:sagemaker:eu-central-1:123456789012:labeling-job/example-job", - "labelAttributeName": "example-attribute", - "roleArn": "aws:aws:iam::{{account_id}}:role/sagemaker-role", - "payload": { - "s3Uri": "s3://sagemakerexample/output/example-job/annotations/worker_response/iteration-1/0/2019-09-06_18:35:03.json" - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/sagemaker-ground-truth-pre-human.json b/tests/resources/events/aws/sagemaker-ground-truth-pre-human.json deleted file mode 100644 index 26c9755d2c..0000000000 --- a/tests/resources/events/aws/sagemaker-ground-truth-pre-human.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "2018-10-16", - "labelingJobArn": "arn:aws:sagemaker:eu-central-1:123456789012:labeling-job/example-job", - "dataObject": { - "source-ref": "s3://sagemakerexample/object_to_annotate.jpg" - } -} \ No newline at end of file diff --git a/tests/resources/events/aws/ses-email-receiving.json b/tests/resources/events/aws/ses-email-receiving.json deleted file mode 100644 index 3a80dfe175..0000000000 --- a/tests/resources/events/aws/ses-email-receiving.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "Records": [ - { - "eventSource": "aws:ses", - "eventVersion": "1.0", - "ses": { - "mail": { - "commonHeaders": { - "date": "Wed, 7 Oct 2015 12:34:56 -0700", - "from": [ - "Jane Doe " - ], - "messageId": "<0123456789example.com>", - "returnPath": "janedoe@example.com", - "subject": "Test Subject", - "to": [ - "johndoe@example.com" - ] - }, - "destination": [ - "johndoe@example.com" - ], - "headers": [ - { - "name": "Return-Path", - "value": "" - }, - { - "name": "Received", - "value": "from mailer.example.com (mailer.example.com [203.0.113.1]) by inbound-smtp.eu-central-1.amazonaws.com with SMTP id o3vrnil0e2ic28trm7dfhrc2v0cnbeccl4nbp0g1 for johndoe@example.com; Wed, 07 Oct 2015 12:34:56 +0000 (UTC)" - }, - { - "name": "DKIM-Signature", - "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=example; h=mime-version:from:date:message-id:subject:to:content-type; bh=jX3F0bCAI7sIbkHyy3mLYO28ieDQz2R0P8HwQkklFj4=; b=sQwJ+LMe9RjkesGu+vqU56asvMhrLRRYrWCbVt6WJulueecwfEwRf9JVWgkBTKiL6m2hr70xDbPWDhtLdLO+jB3hzjVnXwK3pYIOHw3vxG6NtJ6o61XSUwjEsp9tdyxQjZf2HNYee873832l3K1EeSXKzxYk9Pwqcpi3dMC74ct9GukjIevf1H46hm1L2d9VYTL0LGZGHOAyMnHmEGB8ZExWbI+k6khpurTQQ4sp4PZPRlgHtnj3Zzv7nmpTo7dtPG5z5S9J+L+Ba7dixT0jn3HuhaJ9b+VThboo4YfsX9PMNhWWxGjVksSFOcGluPO7QutCPyoY4gbxtwkN9W69HA==" - }, - { - "name": "MIME-Version", - "value": "1.0" - }, - { - "name": "From", - "value": "Jane Doe " - }, - { - "name": "Date", - "value": "Wed, 7 Oct 2015 12:34:56 -0700" - }, - { - "name": "Message-ID", - "value": "<0123456789example.com>" - }, - { - "name": "Subject", - "value": "Test Subject" - }, - { - "name": "To", - "value": "johndoe@example.com" - }, - { - "name": "Content-Type", - "value": "text/plain; charset=UTF-8" - } - ], - "headersTruncated": false, - "messageId": "o3vrnil0e2ic28trm7dfhrc2v0clambda4nbp0g1", - "source": "janedoe@example.com", - "timestamp": "1970-01-01T00:00:00.000Z" - }, - "receipt": { - "action": { - "functionArn": "arn:aws:lambda:eu-central-1:123456789012:function:Example", - "invocationType": "Event", - "type": "Lambda" - }, - "dkimVerdict": { - "status": "PASS" - }, - "processingTimeMillis": 574, - "recipients": [ - "johndoe@example.com" - ], - "spamVerdict": { - "status": "PASS" - }, - "spfVerdict": { - "status": "PASS" - }, - "timestamp": "1970-01-01T00:00:00.000Z", - "virusVerdict": { - "status": "PASS" - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/sns-notification.json b/tests/resources/events/aws/sns-notification.json deleted file mode 100644 index 4bb79dee1e..0000000000 --- a/tests/resources/events/aws/sns-notification.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "Records": [ - { - "EventSource": "aws:sns", - "EventVersion": "1.0", - "EventSubscriptionArn": "arn:aws:sns:eu-central-1:{{{accountId}}}:ExampleTopic", - "Sns": { - "Type": "Notification", - "MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", - "TopicArn": "arn:aws:sns:eu-central-1:123456789012:ExampleTopic", - "Subject": "example subject", - "Message": "example message", - "Timestamp": "1970-01-01T00:00:00.000Z", - "SignatureVersion": "1", - "Signature": "EXAMPLE", - "SigningCertUrl": "EXAMPLE", - "UnsubscribeUrl": "EXAMPLE", - "MessageAttributes": { - "Test": { - "Type": "String", - "Value": "TestString" - }, - "TestBinary": { - "Type": "Binary", - "Value": "TestBinary" - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/sqs-receive-message.json b/tests/resources/events/aws/sqs-receive-message.json deleted file mode 100644 index a24697a237..0000000000 --- a/tests/resources/events/aws/sqs-receive-message.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Records": [ - { - "messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb78", - "receiptHandle": "MessageReceiptHandle", - "body": "Hello from SQS!", - "attributes": { - "ApproximateReceiveCount": "1", - "SentTimestamp": "1523232000000", - "SenderId": "123456789012", - "ApproximateFirstReceiveTimestamp": "1523232000001" - }, - "messageAttributes": {}, - "md5OfBody": "{{{md5_of_body}}}", - "eventSource": "aws:sqs", - "eventSourceARN": "arn:aws:sqs:eu-central-1:123456789012:MyQueue", - "awsRegion": "eu-central-1" - } - ] -} \ No newline at end of file diff --git a/tests/resources/events/aws/stepfunctions-error.json b/tests/resources/events/aws/stepfunctions-error.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/tests/resources/events/aws/stepfunctions-error.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/tests/resources/events/custom/hello-world.json b/tests/resources/events/custom/hello-world.json deleted file mode 100644 index 4ccb6ff485..0000000000 --- a/tests/resources/events/custom/hello-world.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "key1": "value1", - "key2": "value2", - "key3": "value3" -} \ No newline at end of file