Skip to content

Conversation

@maxday
Copy link
Contributor

@maxday maxday commented May 11, 2021

This PR bootstraps the integration tests setup for metrics and logs with the followings scenarios :

  • enhanced metrics ON
  • enhanced metrics OFF
  • timeout
  • logs

@maxday maxday changed the title Add metrics integration testing (v1) Add metrics integration testing Jun 9, 2021
@maxday maxday changed the title Add metrics integration testing Add metrics and logs integration testing Jun 9, 2021
runtime: nodejs12.x
handler: src/metric.enhancedMetricTest
layers:
- arn:aws:lambda:${self:provider.region}:601427279990:layer:Datadog-Node12-x:${env:LAYER_VERSION}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pull the Node layer from the prod account (464622532012). That way we are testing the development version of the extension with the production Lambda Library.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Todo : retrieve this layer version automatically from AWS
LAYER_VERSION: 6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename this to NODE_LAYER_VERSION to make it more clear which layer we are talking about here.

Copy link
Contributor Author

@maxday maxday Jun 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ as we'll add more functions in different languages soon


async function myTimeoutHandler(event, context) {
sendDistributionMetric("serverless.lambda-extension.integration-test.count", invocationCount);
await new Promise(r => setTimeout(r, 30*1000)); //30 sec to be sure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: For testing timeouts, I prefer to create an infinite loop. That way, the function will definitely time out no matter how I adjust the Lambda timeout setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've adjust it with the max AWS allowed timeout value ✅

@@ -0,0 +1,59 @@
name: build

on: push
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't we going to run this hourly? Where is that set up?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if the tests fail, will we be notified somehow?

Copy link
Contributor

@nhinsch nhinsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! 💯

I left a few last-minute questions about the GitHub action.

@maxday maxday merged commit d786715 into main Jun 10, 2021
@maxday maxday deleted the maxday/integration-test branch June 10, 2021 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants